Click here to Skip to main content
13,897,030 members
Rate this:
Please Sign up or sign in to vote.
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
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
       <add name="ASPNETDBConnectionString" connectionString="Data Source=localhost;Integrated Security=sspi; initial catalog=aspnetdb; User Instance=False"

            providerName="System.Data.SqlClient" />

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
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You need to add the Network Service user to the authorized users in the SQL database.
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
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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.[^]

[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)[^][^][^]

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

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web02 | 2.8.190306.1 | Last Updated 16 Sep 2013
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100