SQL Server Compact is not intended for ASP.NET development

Posted by Blake on 8/3/2013
)

I ran into this exception while taking a look at the ScrewnTurnWiki source code:

    SQL Server Compact is not intended for ASP.NET development

Even though I was referencing the correct 4.0 SqlServerCe assembly it kept tossing this exception (which, I’ve used SQL Server Compact with ASP.NET before and never had this issue). After some searching I had someone suggest adding this line of code before the database objects are setup.

C#

    AppDomain.CurrentDomain.SetData("SQLServerCompactEditionUnderWebHosting", true);

VB.Net

    AppDomain.CurrentDomain.SetData("SQLServerCompactEditionUnderWebHosting", True)

I was also previewing the in development version of STW that targets the 4.0 framework. The original developer stopped development and it seems to have been picked up by a group that have moved the project over to Codeplex. I’m not really sure what state the project is in or if will quickly fizzle out. Time will tell.