Thursday, October 22, 2009

SQL Server Compact is not intended for ASP.NET development

SQL Server Compact is a very restricted SQL Server edition in terms of features. But it runs in-process, wich means it does not run as a service being accessed from your application, like others SQL Sever editions. It runs inside your app. This allows for simplified deploy (non-administrative accounts can install an application using SQL Server CE databases), and reduced RAM, CPU and disk usage. It runs even on Windows Mobile!

Well, if you try to use it on an ASP.NET site, you end up with the error "SQL Server Compact is not intended for ASP.NET development". The reason is, like the message says, SQL Server CE is not made to be used on a multi-user environment like a web aplication. But if you want to use it anyway, for exampe for a quick test, place the following code on Global.asax:

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
AppDomain.CurrentDomain.SetData("SQLServerCompactEditionUnderWebHosting", True)
End Sub

This way you are "taking full responsability" for using SQL Server CE on the ASP.NET site, and the error won't show up again.

No comments:

Post a Comment