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.

1 comment:

  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a .Net developer learn from Dot Net Training in Chennai. or learn thru Dot Net Training in Chennai. Nowadays Dot Net has tons of job opportunities on various vertical industry.
    or Javascript Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry.

    ReplyDelete