Windows Server 2008 / SQL Express 2005 / Visual Studio 2008 / Authentication / ASP.NET 2.0.50727


Two weeks ago I installed Windows Server 2008 standard on my home computer, Installed all updates service packs, etc.  I then installed Visual Studio 2008 and installed all updates and service packs, etc. and began to write a website.  I'm using C# with forms authentication.  I am using standard login, loginview controls provided with Visual Studio 2008.

When I run run the application from http://localhost I am able to log in successfully.

When I run my application from I am not able to log in successfully, however, I am able to see the default page and login control.

 Every post have I have read, suggests writing the connectionstring in the web.config file in this manner:




<remove name="LocalSqlServer"/>

<add name="LocalSqlServer" connectionString="Data Source=localhost;Initial Catalog=aspnetdb;Integrated Security=True" providerName="System.Data.SqlClient"/>


When I place the above connectionString in my application, I receive the imfamous message:

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.

The following message may help in diagnosing the problem: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server

When I take the connectionString out of my web.config file, all is well when I attempt to log via the http://localhost

I re-evaluated and re-wrote the "machine connectionString" in the IIS 7.0 manager and that proved to be hours of fruitless labor.

I've visited to re-trace my steps in which I successfully used Mr. Gutherie's tutorial on using aspnet_regiis and aspnet_regsql...  TO NO AVAIL with Windows Server 2008 ... 

Is there any information that anyone can provide in a consistent, user friendly manner that will fix this problem I am having in which I am unable to authenticate users from the internet...

For those who are wondering, it is a Master's Degree Program 6000 class project.  The idea is not to help me with school, rather help me configure the server and authentication correctly so I can concentrate on the actual application and electronics to make a truly distributed web application to control a robot via the internet. 

Thanks very much,


Karl Eldridge

0 KEldridge 4/14/2009 1:17:14 PM


When I run my application from I am not able to log in successfully

How do you set your forms auth. do you set "domain" attribute?  please post your authentication elements part in web.config here.

 Every post have I have read, suggests writing the connectionstring in the web.config file in this manner

Since you are using login control provide by ASP.NET, At the first time you run the page. ASP.NET will create everything for you include Membership provider database. Configuration and connectionString. you can find it in

 C:\WINDOWS\Microsoft.NET\Framework 2.0.50727\CONFIG\machine.config

Gutherie's tutorial on using aspnet_regiis and aspnet_regsql...  TO NO AVAIL with Windows Server 2008 ... 

It works fine in my Windows Server 2008,  check that you execute aspnet_regsql command in "Visual Studio 2008 command Prompt".




Andrew Zhu
Microsoft online ASP.NET support
Please remember to click €œMark as Answer€ on the post that helps you. This can be beneficial to other community members reading the thread.
0 Andrew 4/16/2009 11:22:33 AM

Hello Andrew -

Well, it seems that I did not provide enough information in my first post and my comment regarding "TO NO AVAIL" seems to have been misinterpreted, perhaps due to my panicked ramblings after not sleeping for days Huh?

So let me describe the situation again:  When connecting to the local host (an internal network, IP Address, not seen by the internet (users outside my local area connection), Mr. Gutherie's tutorial using the aspnet_regiis and aspnet_reqsl works fine and I have no issues....In fact, the connection string is not even added to the web.config file .  The connection string is located in the IIS configuration manager and can be viewed by selecting start>settings>control panel>administrative tools - and by clicking the IIS configuration manager I can see the connection string data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true; AND AGAIN IT WORKS FINE FOR A LOCAL AREA CONNECTION.  The connection string is present in the Server Home and when I drill down to the Default Web Page and any virual directory that I might have.

However, when I attempt to login outside my local area connection, from a remote location, this is where I have multiple issues. I have a static IP address, my DSL connection allows connections on port 80 when my modem is set in bridge mode to allow connections to my server and is pointing to my home server through my web hosting package, I am able to connect to my website's Default Page and any other page that I might create, including static htm, html, asp, pages. But I still cannot successfuly connect to the SQL Express database - which is successfully created and present with 3 users.  If I configure in the web.config string to point to the ASP.NET I get the failure described in my orginal post stating the the aspnet configuration wizard has a problem finding the data store.

So, at present, when I avoid using the SQLExpress Database entirely and place the following connection string in my web.config file:


0 KEldridge 4/16/2009 2:50:06 PM

(Thread closed)