Click here to Skip to main content
15,885,435 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good day all, Please can some one help me out here, i am using windows 7 and i have setup my IIS, I installed an application so i can view it on my browser like this localhost/me/default.aspx.
it worked fine, but when ever i want to log in it shows this error
C#
Cannot open database "aspnetdb" requested by the login. The login failed.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.


<pre lang="c#">
// my connection string is this
<connectionStrings>
       <add name="ASPNETDBConnectionString" connectionString="Data Source=localhost;Integrated Security=sspi; initial catalog=aspnetdb; User Instance=False"
            providerName="System.Data.SqlClient" />
    </connectionStrings>


i have gone to C:\inetpub\wwwroot\me, clicked on property, Security, Network Service... I have enabled the Read, Write, and Modify. when I preview it is still showing same Error...
My database is on same folder App_Data..

Please can someone help me out here
Posted

You need to add the Network Service user to the authorized users in the SQL database.
 
Share this answer
 
Comments
Difameg Network Nigeria 15-Sep-13 0:37am    
Hhow do i do that Please, thanks
Ron Beyer 15-Sep-13 0:41am    
You can see this StackOverflow answer to see how to do it. Just run the command in SQL Management Studio.
Difameg Network Nigeria 15-Sep-13 0:50am    
thank you, how do i locate the sp_grantlogin i am not using sql server, the database was created using the db insyde visual studio

thanks for your time, i appreciate
Under ApplicationPoolIdentity you will find local system. This will make your application run under NT AUTHORITY\SYSTEM, which is an existing login for the database by default.

http://stackoverflow.com/questions/7698286/login-failed-for-user-iis-apppool-asp-net-v4-0[^]

[Edit: noticed the image does not show up properly in R.H.S], So just select Application Pool -> a pool entry -> Advanced Settings... (from Edit Application Pool section) -> Process Model (from Advanced Setting dialog box)

http://forums.asp.net/t/1510479.aspx[^]

http://blog.igorware.com/login-failed-for-user-iis/[^]

http://www.aspdotnet-suresh.com/2011/05/systemdatasqlclientsqlexception-login.html[^]

just the matter is you have the user which does not have authority to use the database,......:)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900