Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Cannot open Database

Author  Topic 

shapper
Constraint Violating Yak Guru

450 Posts

Posted - 2009-10-20 : 16:37:19
Hello,

I published a ASP.NET web site and copied the files to my computer wwwroot to test it under IIS 7 in my computer before I send it to the hosting server.

I get the following error (this web site uses a SQL 2008 Server database):

Cannot open database "DBC" requested by the login. The login failed.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Cannot open database "DBC" requested by the login. The login failed.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

My Web.Config file is as follows:

<connectionStrings>
<add name="DBC.Domain.Properties.Settings.DBCConnectionString"
connectionString="Data Source=FLYONDREAMS\SQLEXPRESS;Initial Catalog=DBC;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>

I have only one user in my Windows, which is me, and which is Administrator.

FlyOnDreams is the name I gave to WorkGroup when I installed windows vista 64 bits.

On my SQL Server Express 2008 I have on Security:

Server Authentication: "SQL Server and Windows Authentication Mode"

Login Auditing: Failed Logins Only

Could someone tell me what might be wrong?

Thanks,

Miguel

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-10-20 : 17:03:52
Can you instead use SQL authentication in your connection string? It's so much simpler with web apps.

The SQL account will need to be created and given permissions for that method though.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page
   

- Advertisement -