views:

650

answers:

6

Hi. I been strugling with this for 2 days now without comming any closer to solution. I have read 20-30 threads alteast and stil can not resolve this.

Please help me out.

I have disable anonymous authentication, enable asp.net impersonation.

I have added <identity impersonate = "true" />

I have added the a user to the security logins that is connected to the database I try to connect to

This is the connectionstring I use:

Data Source=IPTOSERVER;Initial Catalog=Phaeton;User Id=User;Password=Password;

errormessage:

Cannot open database "Phaeton.mdf" requested by the login. The login failed.

Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

A: 

Dejan how are you doing? Plese check this, it has all the possible combination regarding connection strings: http://www.connectionstrings.com/

Hope it helps!

MRFerocius
+1  A: 

NT AUTHORITY\NETWORK SERVICE when used as a SQL Server login is DOMIAN\machinename$

eg

CREATE LOGIN [XYZ\Gandalf$] FROM WINDOWS
gbn
Can you be more specific what I need to do? cause this don't make no sense to me(it really don't:))
Dejan.S
A: 

You said it worked fine when you were using SQL Express edition. By default express editions create a named instance & run in NT Authority\Network Service.

SQL Server STD by default install a default instance & run in NT Authority\SYSTEM.

Do you have both the full SQL edition & Express edition installed on the same machine?

  1. It could be that somewhere the connection string still refers to the Named instance 'SQLEXPRESS' rather than the default instance created by the full version.

  2. Also where is the connection string defined? In IIS or your code? Make sure that if defined in many places, all point to same SQL instance & database.

  3. Also try looking at the detailed error present in the SQL Server error logs. The error logged in event log are not complete for secuirty reasons. This will also help you to know if the connection was made to the correct SQL Server.

  4. Also make sure that the machine on which SQL is installed is accessible & IIS is trying to access the same machine. In my company sometimes due to wrong name resolution, the query fails since most of our computers have SQL installed & the query lands in the wrong SQL Server.

  5. Make sure that the database exists in the SQL Server. The name displayed under databases in SQL Management Studio should match that in the connection string.

Ganesh R.
I only got sql server on this server computer. I have only made the connectionstring in my Web.Config file. I will try to look at the log file now and see if I get any more specific error. database is connected to the sql server and I created a user that is suppose to use it. It somehow just keeps going for the NT Auth.. when I want to use the sql auth
Dejan.S
+1  A: 

The error message you are receiving is telling you that the application failed to connect to the sqlexpress db, and not sql server. I will just change the name of the db in sql server and then update the connectionstring accordingly and try it again.

Your error message states the following:

Cannot open database "Phaeton.mdf" requested by the login. The login failed.

It looks to me you are still trying to connect to the file based database, the name "Phaeton.mdf" does not match with your new sql database name "Phaeton".

Hope this helps.

Ricardo
life saver thanks a lot. I totally missed that the database i tried to use was sqlexpress.
Dejan.S
A: 

Please simply follow the How-tos on ASP.NET and SQL Server,

http://msdn.microsoft.com/en-us/library/ms978512.aspx

There are the recommended ways to connect to SQL Server.

Regards,

Lex Li
A: 

I was experiencing a similar error message that I noticed in the Windows Event Viewer that read:

Login failed for user 'NT AUTHORITY\NETWORK SERVICE'. Reason: Failed to open the explicitly specified database. [CLIENT: local machine]

The solution that resolved my problem was:

  1. Login to SqlExpress via SQL Server Management Studio
  2. Go to the "Security" directory of the database
  3. Right-click the Users directory
  4. Select "New User..."
  5. Add 'NT AUTHORITY\NETWORK SERVICE' as a new user
  6. In the Data Role Membership area, select db_owner
  7. Click OK

Here's a screenshot of the above: Screenshot of adding new user Network Service as db_owner to SqlExpress

Jed