Bite my bytes

What I learn by day I blog at night.

  Home :: Contact :: Syndication  
  849 Posts :: 5032 Comments :: 235 Trackbacks

Search

Recent Comments.

Recent Posts

Most popular posts
in last 360 days

Categories

My Projects

Archives

Stuff


Copyright © by David Vidmar
 
Contact me!
 
LinkedIn Profile
 
 
 
Server Monitor

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

Posted on Thursday, April 19, 2007 3:30 PM | Filed under: Developement |

 

Feedback

# re: SQL Server 2005 Compact Edition and ASP.NET 4/21/2007 12:00 AM Munir
top

# re: SQL Server 2005 Compact Edition and ASP.NET 5/9/2007 10:04 AM maxime lamure
Great, thanks for this tip.

# re: SQL Server 2005 Compact Edition and ASP.NET 6/16/2007 6:01 AM Miguel Madero
Wow this was really helpful!!!
:D



# re: SQL Server 2005 Compact Edition and ASP.NET 3/10/2008 4:45 AM Cotfas Liviu
Thank you! :)

# re: SQL Server 2005 Compact Edition and ASP.NET 9/9/2008 11:38 PM Matt Jensen
You're the MAN! Thank you!

# re: SQL Server 2005 Compact Edition and ASP.NET 10/1/2008 9:10 AM steve peach
Thanks so much for posting the solution to allow asp.net to use compact server 3.5!

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

You really saved me a lot of time.
Steve

# re: SQL Server 2005 Compact Edition and ASP.NET 10/25/2008 12:54 AM Andy
Hats of to the man !
Grubbed around all night on my server trying to fix this, and lo...
just get the spelling right and it all works.

Someone buy them a beer !

# re: SQL Server 2005 Compact Edition and ASP.NET 4/28/2009 1:25 PM chanaka pradeep
WOW, thanks. otherwise i thought to convert mt .sdf DB to SQL SERVER edition
thanks.

# re: SQL Server 2005 Compact Edition and ASP.NET 5/29/2009 8:55 PM carlos
This is really good information. I was in need of this for a simple website.

Post Feedback

Title:
Name:
Email: (never displayed)
Url:
Comments: 
Please add 4 and 1 and type the answer here: