Sunday, September 02, 2007

.NET - Connecting to SQL Server Express from VWDE

I was trying a tutorial for Visual Web Developer Express, and kept running into problems connecting to SQL Server Express. When I tried to configure the security settings by clicking on the security tab in the ASP.NET Web Site Administration Tool, I received the following error:
There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store.

After researching a bit, I used the SQL Server Configuration Manager to use "Local System" as the built-in account (found under the [Log On] tab for the running SQL Server Express instance). Then, I had to add a Web.config to my project with the following connection strings:

<remove name="LocalSqlServer"/>
<add name="LocalSqlServer"
connectionString="Data Source=localhost;
Initial Catalog=aspnetdb;
Integrated Security=True"

After that, the connection succeeded, and I was able to continue with the tutorial.

1 comment: