Wednesday, March 7, 2012

How can I use Sql Express instead of Sql Server 2005 for asp.net providers

Hi all,

Since I activated the aspnet_regsql.exe tool, it has been a bad day - here's why:

Originally I installed VS2005 Pro (without Sql Express) and then Sql Server 2005 Dev. I then started to learn asp.net from the ".NET FRAMEWORK 2.0 Web-Based client Development" Training kit from Micorsoft. I have compiled and run every exercise up till Chapter 9 lesson 2 exercise 1, without the need to start the Sql Server 2005. In exercise 2 I should learn about asp.net profilers and the exercise showed me to use the aspnet_regsql.exe tool if I was using Sql Server 2005 - and so I did, and exercise 2 worked fine after a couple of adjustment in the connection string, because it was configured to use the SQLEXPRESS server by default.

However - in Chapter 9 lesson 3, I should not use asp.net providers, so I shut down the Sql Server 2005, because I don't have that much memory to spend. Now the trouble comes - every website I have made afterwards require that the Sql Server 2005 is running or else I get some errors.

How can I get back to the way it was before I activated the aspnet_regsql.exe, so I don't have to have the Sql Server 2005 running every time I want to make a website using aspx?

Thanks in advance

From your description, it sounds like you need to change the connection strings to use the SQL Express instance instead of the SQL Developer instance.|||

My connection string in both the machine.config and web.config, located in <Win dir>\Microsoft.NET\Framework\v2.0.50727\CONFIG, looks like this:

<connectionStrings>

<add name="LocalSqlServer" connectionString="data source=.\SQLEXPRESS;

Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;UserInstance=true"

providerName="System.Data.SqlClient" />

</connectionStrings>

And I do not use an web.config at the website level.

I have also tried to reverse the action done by aspnet_regsql, by selecting the "Remove application services information from an existing database" option when starting aspnet_regsql.exe. Then detaching the aspnetdb database in Sql Server 2005 and deleted the aspnetdb files (mdb and log files) from Sql Server 2005 - all with out luck.

No comments:

Post a Comment