While preparing for one of my presentations an NT Konferenca 2007 titled "Pocket database: Microsoft SQL Server 2005 Compact Edition" I did some googling on the subject of running Microsoft SQL Server 2005 Compact Edition (formerly "Compact", formerly "Mobile", formerly "CE") under ASP.NET which by default results in error "SQL Server Compact Edition is not intended for ASP.NET development".
There are various blog posts around the web stating different things that aren't true, at least not with latest RTM version of SQL2005CE:
- Dan, Roger and Anonymous Commenter say you should set "SqlServerCompactUnderWebHosting" but it doesn't work with RTM.
- Steve says you should set "SqlServerEverywhereUnderWebHosting" - also doesn't work with RTM.
The right setting is "SQLServerCompactEditionUnderWebHosting". So, just put
AppDomain.CurrentDomain.SetData("SQLServerCompactEditionUnderWebHosting", true);
in your code and you are go.
This was found on relatively unrelated MSDN page called Deployment Considerations. I was ready to go digging with Reflector but I was lucky with Google just before I did that. Looks Geoff was not that lucky.