SQL Server 2008 login problem with ASP.NET application: Failed to open the explicitly specified database

I would test with an explicit account that I set up on the local computer and put into the IIS app as the anonymous user. That way you can test it from SSMS or VS and be sure that you can connect to the server and database without issue.

Once that is working, or if it's not, you can debug where in the ASP side it might be failing. The SQL side is simple, though I've not tried the Network Service account. Should be no reason it doesn't work, but I haven't seen anyone use it.


Just off the top of my head, would the in the web.config file possibly be a trust level problem? Also, is the SQL Server in Windows authentication mode or Mixed authentication mode? Is SQL Server configured for TCP/IP? I think in SQL Server 2008 TCP/IP is disabled and uses Shared Memory or Named Pipes by default.


If the database instance is on a different server than the web application then you will need to add a SQL login for DOMAIN\WEBSERVER$ and then grant it access to the proper database.


For the security acct in question on SQL Server, is the "default database" set to the appropriate database or is it still listed as the default "Master" database?o


I chased this error around for an hour or more. I tried many things including Sql Server configuration, adding the Network Service user and others.

You need to make sure that the database specified in the connection string matches the one that you have granted permissions to the user for.

However, in the end the issue I had was that my database in my connection string had a typo - a l and an i were transposed, which was hard to pick up in the resolution I was using.

So my suggestion here is : find another application that allows you to test a connection string, and test the connection string.