Login failed for user 'NT AUTHORITY\NETWORK SERVICE'<P>Any help would be very very much appreciated as I am about 15 hours into this :(</P> <P>Background is a development system with ASP.NET 2.0 and SQL express 2005. The server is SQL 2005 standard edition. Any ASPX pages that connect to a database results in errors.</P> <P>I have 2 identical servers with Windows server 2003, one has SQL Express and the other has SQL Server 2005 standard. that is the only difference between these systems. The scripts that work seamlessly when uploaded to the SQL Express server dont work on the SQL Server 2005</P> <P>My connection string is </P> <P>&nbsp;&lt;remove name="LocalSqlServer" /&gt;<BR>&lt;add name="LocalSqlServer" connectionString="Datasource=servername;Integrated Security=SSPI;initial catalog=C:\INETPUB\WWWROOT\test\app_data\aspnet.MDF;"<BR>&nbsp;&nbsp; providerName="System.Data.SqlClient" /&gt;</P> <P>two interesting tidbits</P> <P>1.) No matter what the initial catalog is pointing to, I get the same error. EVEN if the database doesnt exist</P> <P><EM>Cannot open database "C:\INETPUB\WWWROOT\test\app_data\aspnwet.MDF" requested by the login. The login failed.<BR>Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.</EM> </P> <P>2.) second interesting thing is this, if I change the datasource to "MSSQLSERVER" which is the instance name of SQL 2005. the error changes to</P> <P><EM>An error has occurred while establishing a connection to the server. &nbsp;When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)</EM> </P> <P>I have reinstalled SQL server 2005</P> <P>I have verified that under SQL Server 2005 Surface Area Configuration that remote connections has Both TCP and Named Pipes enabled</P> <P>I have verified that under the Network Configuration that the protocols for TCP/IP and Named pipes are enabled.</P> <P>I have tried atleast 20 different variations of Connectionstrings</P> <P>I have ran aspnet_regsql against the database</P> <P>I have verified that the SQL Server Browser is started</P> <P>I have verified that the TCP/IP is set in Network Configuration to default port 1433</P> <P>I have gave all authentication rights to Network Service and ASPNET accounts for testing against both the MASTER and ASPNET databases using Management Studio and attaching the Database</P> <P>I have created a custom SQL account with access to the database in question and added the username password syntax to the connectionstring and get the same login failed message. </P> <P>If anyone can give any insight that would be MUCH appreciated!! thanks in advance.<BR></P> <P>&nbsp;</P>© 2009 Microsoft Corporation. All rights reserved.Mon, 23 Nov 2009 16:24:02 Za31656a9-5715-4910-ad96-fa590344a407http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#a31656a9-5715-4910-ad96-fa590344a407http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#a31656a9-5715-4910-ad96-fa590344a407Akirenhttp://social.msdn.microsoft.com/Profile/en-US/?user=AkirenLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'<P>Any help would be very very much appreciated as I am about 15 hours into this :(</P> <P>Background is a development system with ASP.NET 2.0 and SQL express 2005. The server is SQL 2005 standard edition. Any ASPX pages that connect to a database results in errors.</P> <P>I have 2 identical servers with Windows server 2003, one has SQL Express and the other has SQL Server 2005 standard. that is the only difference between these systems. The scripts that work seamlessly when uploaded to the SQL Express server dont work on the SQL Server 2005</P> <P>My connection string is </P> <P>&nbsp;&lt;remove name="LocalSqlServer" /&gt;<BR>&lt;add name="LocalSqlServer" connectionString="Datasource=servername;Integrated Security=SSPI;initial catalog=C:\INETPUB\WWWROOT\test\app_data\aspnet.MDF;"<BR>&nbsp;&nbsp; providerName="System.Data.SqlClient" /&gt;</P> <P>two interesting tidbits</P> <P>1.) No matter what the initial catalog is pointing to, I get the same error. EVEN if the database doesnt exist</P> <P><EM>Cannot open database "C:\INETPUB\WWWROOT\test\app_data\aspnwet.MDF" requested by the login. The login failed.<BR>Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.</EM> </P> <P>2.) second interesting thing is this, if I change the datasource to "MSSQLSERVER" which is the instance name of SQL 2005. the error changes to</P> <P><EM>An error has occurred while establishing a connection to the server. &nbsp;When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)</EM> </P> <P>I have reinstalled SQL server 2005</P> <P>I have verified that under SQL Server 2005 Surface Area Configuration that remote connections has Both TCP and Named Pipes enabled</P> <P>I have verified that under the Network Configuration that the protocols for TCP/IP and Named pipes are enabled.</P> <P>I have tried atleast 20 different variations of Connectionstrings</P> <P>I have ran aspnet_regsql against the database</P> <P>I have verified that the SQL Server Browser is started</P> <P>I have verified that the TCP/IP is set in Network Configuration to default port 1433</P> <P>I have gave all authentication rights to Network Service and ASPNET accounts for testing against both the MASTER and ASPNET databases using Management Studio and attaching the Database</P> <P>I have created a custom SQL account with access to the database in question and added the username password syntax to the connectionstring and get the same login failed message. </P> <P>If anyone can give any insight that would be MUCH appreciated!! thanks in advance.<BR></P> <P>&nbsp;</P>Thu, 13 Apr 2006 17:06:51 Z2006-04-14T16:56:36Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#cb7186b3-74b1-44c6-be75-f8e6c9a3e6ddhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#cb7186b3-74b1-44c6-be75-f8e6c9a3e6ddNan Tuhttp://social.msdn.microsoft.com/Profile/en-US/?user=Nan%20TuLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'<P>Akiren.</P> <P>&nbsp; (1) You are failing on user permission check to sql server as whole not individual database,&nbsp;so no matter what catalog your refering to. I assume the sql server is running on a local machine. This is a IIS and ASP.Net configuration issue, I would recommend you to&nbsp;check with ASP.NET forum and IIS forum w.r.t&nbsp;connection authentication to sql server.&nbsp;I think you probably need to set connection&nbsp;impersonation in IIS or ASP. Also, you can check SQL security forum. There is a difference that special to sqlexpress in authenticate user connections.</P> <P>&nbsp;</P> <P>&nbsp;&nbsp; (2) datasource, if it is not (local), "." or "&lt;empty", it will be refer to as &lt;servername&gt;[\&lt;instancename&gt;]. In your case, MSSQLSERVER is not a valid &lt;servername&gt;, so the connection string does not work.</P> <P>&nbsp;</P> <P>&nbsp;</P>Thu, 13 Apr 2006 19:39:26 Z2006-04-13T19:39:26Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#3686a942-d0e1-41ec-9d60-32d62e861f88http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#3686a942-d0e1-41ec-9d60-32d62e861f88Akirenhttp://social.msdn.microsoft.com/Profile/en-US/?user=AkirenLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'<p>Its not an IIS or ASP.NET configuration issue as far as I can tell. Even if I goto the command prompt and type</p> <p>sqlcmd -s SQLINSTANCE -e </p> <p>I get the same named pipes sql server does not allow remote connections. The SQL Server is local. </p> <p>One interesting tidbit, whenever I try to put SERVERNAME\INSTANCE in the connection string or even dos I get an invalid connection string.</p>Thu, 13 Apr 2006 20:29:54 Z2006-04-13T20:29:54Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#aa974fbf-b61b-419a-8bdd-21c4c10390fbhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#aa974fbf-b61b-419a-8bdd-21c4c10390fbNan Tuhttp://social.msdn.microsoft.com/Profile/en-US/?user=Nan%20TuLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'<p>Maybe I didn't explain to you clearly.</p> <p>The item(1)  was to your first issue, and (2) was to your second issue. Your first issue looks like a ASP/IIS issue. The second issue is because you are composing a connection string that does not point to a real server. </p> <p> </p> <p>Is SQLINSTNACE your machine name? </p> <p>For the default instance, you can use &lt;machinename&gt;,</p> <p>For nameinstance, you can use &lt;machinename&gt;\&lt;instancename&gt;.</p> <p> </p>Fri, 14 Apr 2006 02:02:24 Z2006-04-14T16:56:36Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#d39aebcf-6304-49e0-8def-b07818325ac5http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#d39aebcf-6304-49e0-8def-b07818325ac5Erwin De Leonhttp://social.msdn.microsoft.com/Profile/en-US/?user=Erwin%20De%20LeonLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'<p>Hi Akiren, </p> <p>How are you? </p> <p>There are only  two solutions to your problem.<br>1. Close the MS Visual Studio (it will stop the SQL express) and run your application via IE (assuming that the you've configured your Virtual directory).<br>2. Detach from SQL Express and transfer your DB to other SQL Server 2005 edition.</p> <p>SQL Server Express Edition allows only a single connection to an .mdf file</p> <p><br>Erwin De Leon<br><a title="http://www.mrwebservice.net" href="http://www.mrwebservice.net">www.mrwebservice.net</a></p>Tue, 15 Aug 2006 10:20:42 Z2006-08-15T10:20:42Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#f8639a66-bee5-44c3-acaf-b5f3c40bed33http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#f8639a66-bee5-44c3-acaf-b5f3c40bed33BrEnO_LEWROYhttp://social.msdn.microsoft.com/Profile/en-US/?user=BrEnO_LEWROYLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'<p>Hi,</p> <p> </p> <p>You´ve to change &quot;Integrated Security=SSPI&quot; to &quot;Integrated Security=false&quot;;</p> <p>I think it will fix it!</p> <p> </p> <p>[]´s Breno</p>Thu, 07 Dec 2006 11:17:20 Z2006-12-07T11:17:20Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#2f198f57-7ce5-43d8-a96b-75199c419f29http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#2f198f57-7ce5-43d8-a96b-75199c419f29tommy123456http://social.msdn.microsoft.com/Profile/en-US/?user=tommy123456Login failed for user 'NT AUTHORITY\NETWORK SERVICE'<p> </p> <p>This is an internal acct that is not displayed in user manager - you can't depend on a GUI....</p> <p> </p> <p>submit this line into query analyzer on master or your database to grant access:</p> <p>sp_grantlogin 'NT AUTHORITY\NETWORK SERVICE'</p> <p> </p> <p>Its scary to read about the security holes people opened up through ignorance in this blog </p>Tue, 12 Dec 2006 16:25:56 Z2007-10-18T10:17:14Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#5d774bd0-91c7-4c4e-b0ba-413ce4d5a88ehttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#5d774bd0-91c7-4c4e-b0ba-413ce4d5a88eJuanlocohttp://social.msdn.microsoft.com/Profile/en-US/?user=JuanlocoLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'Hi.  I am having the exact same problem!  I tried all the solutions presented and still no luck.  I have the small business starter kit installled on Win2k Adv Srvr where I have trial Studio Web Express w/SQL express no problems.  Move it to a Small Business Server change the .\SQLExpress to the localhost server name ( server11 ) no problem.  Move it out to a site with SQL 2005 trial, try every connection string possible and all the blog solutions - no luck.  Did you ever get a working solution?  Thanks ... I'm pretty new the developer scene but pretty saavy.Tue, 02 Jan 2007 20:18:26 Z2007-01-02T20:18:26Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#f3914ac9-4281-4a24-b07c-7d34eb9b3bachttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#f3914ac9-4281-4a24-b07c-7d34eb9b3bacBrEnO_LEWROYhttp://social.msdn.microsoft.com/Profile/en-US/?user=BrEnO_LEWROYLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'<P>Hi Juan,</P> <P>You are probably having problems because your SQLServer Security is not well-configured.</P> <P>Try to check your confs again... on Security.</P> <P>&nbsp;</P>Tue, 02 Jan 2007 20:36:38 Z2007-01-02T20:36:38Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#9ab9112b-35cb-42f3-9d68-cd951e1b672dhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#9ab9112b-35cb-42f3-9d68-cd951e1b672dJuanlocohttp://social.msdn.microsoft.com/Profile/en-US/?user=JuanlocoLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'Thanks.  I added the NT AUTHORITY\NETWORK SERVICE user to the database and gave it all the permissions I could see through SQL Management studio.  Did the grant login recommended etc.  I thought I tried all possible.  I am guessing that you are correct.  There is no sensitive information on this server, so I haven't gotten into tightening security.  The personal web page starter kit, with some changes, runs fine on the same server.  I guess I could go XML with the Small Business Starter kit, but that would be whimping out I think!  Anything more specific would be helpfull.  Thanks again.Tue, 02 Jan 2007 20:48:40 Z2007-01-02T20:48:40Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#cc5333dd-9930-47c9-a8b8-9d883fdf4d52http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#cc5333dd-9930-47c9-a8b8-9d883fdf4d52Cinni Patelhttp://social.msdn.microsoft.com/Profile/en-US/?user=Cinni%20PatelLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'<p>hi <a id="_ctl0_MainContent__ctl0_PostForm_ReplyPostedBy" href="http://forums.microsoft.com/MSDN/User/Profile.aspx?UserID=138911&amp;SiteID=1"><strong>Akiren</strong></a><span id="_ctl0_MainContent__ctl0_PostForm_ReplyPostedByDate"> </span></p> <p><span>i was facing the same problem but then after changing my connection string to following it was done correctly.</span></p><span><font color="#0000ff" size=2><font color="#0000ff" size=2> <p>&lt;remove name=&quot;LocalSqlServer&quot; /&gt;</p> <p>&lt;</font><font color="#800000" size=2>add</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>name</font><font color="#0000ff" size=2>=</font><font color="#000000" size=2>&quot;</font><font color="#0000ff" size=2>LocalSqlServer</font><font color="#000000" size=2>&quot;</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>connectionString</font><font color="#0000ff" size=2>=</font><font color="#000000" size=2>&quot;</font><font color="#0000ff" size=2>Data Source=localhost;Initial Catalog=Track;user id=sa;password=agile;</font><font color="#000000" size=2>&quot;</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>providerName</font><font color="#0000ff" size=2>=</font><font color="#000000" size=2>&quot;</font><font color="#0000ff" size=2>System.Data.SqlClient</font><font color="#000000" size=2>&quot;</font><font color="#0000ff" size=2>/&gt;</p></font></font><font color="#0000ff" size=2></font></span> <p><span>Please check your LocalSqlServer string again, provide userid, password for connecting sql server.</span></p> <p><span></span> </p>Wed, 07 Mar 2007 12:42:24 Z2007-03-07T12:42:24Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#27699f42-1a1e-461f-a8ca-f427c2010380http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#27699f42-1a1e-461f-a8ca-f427c2010380xiaoyifanghttp://social.msdn.microsoft.com/Profile/en-US/?user=xiaoyifangLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'<p><a id="_ctl0_MainContent__ctl0_PostForm_ReplyPostedBy" href="http://forums.microsoft.com/MSDN/User/Profile.aspx?UserID=411155&amp;SiteID=1"><strong>tommy123456</strong></a><span id="_ctl0_MainContent__ctl0_PostForm_ReplyPostedByDate"> 's method has solve my the same problem <img src="images/emoticons/smile_teeth.gif"></span></p>Tue, 20 Mar 2007 12:22:09 Z2007-03-20T12:22:09Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#b460b9d1-d393-451c-baca-f780671ad2c8http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#b460b9d1-d393-451c-baca-f780671ad2c8G Jovanhttp://social.msdn.microsoft.com/Profile/en-US/?user=G%20JovanLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'<p>I got almost frustrated last night, trying to get things working (setting up permisssions in sqlexpress etc.). Finally this morning, success!</p> <p> </p> <p>I must have some type of error writing connection strings: </p> <p> </p> <p> </p> <p>Now it works with both:</p> <p> </p> <p>either</p> <p> </p> <div id=p2cs2cell><span class=csKeyword>Data Source</span>=<span class=csValue>myServerAddress</span>;<span class=csKeyword>Initial Catalog</span>=<span class=csValue>myDataBase</span>;<span class=csKeyword>Integrated Security</span>=<span class=csValue>SSPI</span>;</div> <div> </div> <div>or</div> <div> </div> <div> <div id=p2cs0cell><span class=csKeyword>Data Source</span>=<span class=csValue>myServerAddress</span>;<span class=csKeyword>Initial Catalog</span>=<span class=csValue>myDataBase</span>;<span class=csKeyword>User Id</span>=<span class=csValue>myUsername</span>;<span class=csKeyword>Password</span>=<span class=csValue>myPassword</span>;</div> <div> </div> <div>Allelujah!</div></div>Sun, 01 Apr 2007 08:31:46 Z2007-04-01T08:31:46Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#a021140f-0431-4f73-9b05-f2d54228a80ahttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#a021140f-0431-4f73-9b05-f2d54228a80aCodecrediblehttp://social.msdn.microsoft.com/Profile/en-US/?user=CodecredibleLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'G Jovan's second connection string (sql) just worked fine for me. But I wonder why first one (windows) is not working. I am still getting Login failed for user 'NT AUTHORITY\NETWORK SERVICE' no matter what you already suggested. I will appreciate very much  if  one can post another advice for the solution. <br>Thu, 12 Apr 2007 18:52:56 Z2007-04-12T18:52:56Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#8ae0caff-330b-49b0-93d2-93e67c312174http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#8ae0caff-330b-49b0-93d2-93e67c312174m_Riahttp://social.msdn.microsoft.com/Profile/en-US/?user=m_RiaLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'<p>Hi</p> <p>My problem has been solved by the following method:</p> <p>Add permissions to  'NT AUTHORITY\NETWORK SERVICE' in the security folder of your SQL 2k5 express.</p>Tue, 24 Apr 2007 06:42:46 Z2007-04-24T06:42:46Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#24a7b978-256c-446a-80ff-6050be58d8c5http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#24a7b978-256c-446a-80ff-6050be58d8c5Alan Churchillhttp://social.msdn.microsoft.com/Profile/en-US/?user=Alan%20ChurchillLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'Ok, I tried everything but what I kept missing was that the Initial Catalog is case-sensitive. I had moved the site to a customer location and they had different casing (same name) for the database. It solved my issue after hours and hours of trying things. Hope it helps someone.Sat, 30 Jun 2007 21:41:25 Z2007-06-30T21:41:25Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#d1802d9b-0cef-4c64-b4e2-de112401b296http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#d1802d9b-0cef-4c64-b4e2-de112401b296VegasDavehttp://social.msdn.microsoft.com/Profile/en-US/?user=VegasDaveLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'<font face="Times New Roman"></font> <p align=left><font face=Arial size=2>Thank you, thank you, thank you, tommy123456.  I've been beating on this all day and your solution works like a charm!  After running :</font></p> <p align=left><font face=Arial size=2></font> </p> <p align=left><font face=Arial size=2>sp_grantlogin 'NT AUTHORITY\NETWORK SERVICE' </font></p> <p align=left><font face=Arial size=2></font> </p> <p align=left><font face=Arial size=2>in query analyzer against both master and my database, and turning on Role Membership for all ASP roles plus db_datareader and db_datawriter, I finally got past that annoyning login failed error message.</font></p> <p align=left> </p> <p align=left>Thank you, thank you, thank you!</p>Sun, 29 Jul 2007 01:59:14 Z2007-07-29T01:59:14Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#309728e5-18d1-4e95-b998-99d6219ef3bbhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#309728e5-18d1-4e95-b998-99d6219ef3bbGustavo Fredericohttp://social.msdn.microsoft.com/Profile/en-US/?user=Gustavo%20FredericoLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'<br>I'm having the same problem with SQL Server Analysis Server. <span id="_ctl0_MainContent_PostFlatView"><span><font face=Arial size=2>sp_grantlogin 'NT AUTHORITY\NETWORK SERVICE' does not apply in this case. I have a web service that connects programmatically to it:<br>conn = new SqlConnection(<br>           Settings.Default.Connection);<br>            conn.Open();<br><br>The client is in a separate machine. If anyone can think of a way for it to work with </font></span></span>SQL Server Analysis Server please reply. Thank you,<br><br>GF<br><br>Mon, 12 Nov 2007 18:48:03 Z2007-11-12T18:48:03Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#b3b90e26-f5fc-4b8e-8db0-12d518918c08http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#b3b90e26-f5fc-4b8e-8db0-12d518918c08Sidheshwarhttp://social.msdn.microsoft.com/Profile/en-US/?user=SidheshwarLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'<p align=left>It has solved my problem in SQL Server 2000<br>Hope it helps to you </p> <p> </p> <p align=left>Please follow below steps : <br>Please confirm the login [NT AUTHORITY/NETWORK SERVICE] is present under Security/Logins Node at SQL Server Instance<br>Right Click on the user[NT AUTHORITY/NETWORK SERVICE] - Select Properties - Go to Database Access Tab - Check the desired database - <br>Assign public - db_owner roles </p> <p> </p> <p align=left>Click Ok,</p> <p align=left>Refresh the database and Finally Try the Application once again.</p> <p>Hope it helps.</p>Mon, 24 Dec 2007 09:00:06 Z2007-12-24T09:00:06Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#172c207d-b08f-4340-9eea-89d6a4b87022http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#172c207d-b08f-4340-9eea-89d6a4b87022blooperhttp://social.msdn.microsoft.com/Profile/en-US/?user=blooperLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'<p>Hi,</p> <p align=left>My problem is wierd.</p> <p align=left> </p> <p align=left>I am trying to assign a user in my code to access my database but it keep defaulting to logging in as NT AUTHORITY/NETWORK SERVICE user.</p> <p align=left><font face=Arial size=2></font> </p> <p align=left>I have no idea why. </p> <p align=left>1) This same user that am am assigning to another database works just fine.</p> <p align=left>2) I have made sure both database contains same user access.</p> <p align=left> </p> <p align=left>My connection strings are as below. But I am being defaulted to NT authority when logging in to OpsTradingDB, Please advise.</p> <p align=left> </p> <p align=left>Thanks in advance.</p> <p align=left> </p><font color="#0000ff" size=2> <p>&lt;</font><font color="#a31515" size=2>connectionStrings</font><font color="#0000ff" size=2>&gt;</p> <p>&lt;</font><font color="#a31515" size=2>add</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>name</font><font color="#0000ff" size=2>=</font><font size=2>&quot;</font><font color="#0000ff" size=2>OpsTradingConnectionString</font><font size=2>&quot;</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>connectionString</font><font color="#0000ff" size=2>=</font><font size=2>&quot;</font><font color="#0000ff" size=2>Server=DEVPC;Database=OperationsTradingDB;User ID=PETREDECS\\AppAcc;Password=Pa$$w0rd;Trusted_Connection=True</font><font size=2>&quot;</font><font color="#0000ff" size=2>/&gt;</p> <p>&lt;</font><font color="#a31515" size=2>add</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>name</font><font color="#0000ff" size=2>=</font><font size=2>&quot;<font color="#0000ff">Employee</font></font><font color="#0000ff" size=2>ConnectionString</font><font size=2>&quot;</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>connectionString</font><font color="#0000ff" size=2>=</font><font size=2>&quot;</font><font color="#0000ff" size=2>Server=DEVPC;Database=EmployeeDetails;User ID=PETREDECS\\AppAcc;Password=Pa$$w0rd;Trusted_Connection=True</font><font size=2>&quot;</font><font color="#0000ff" size=2>/&gt;</p> <p>&lt;/</font><font color="#a31515" size=2>connectionStrings</font><font color="#0000ff" size=2>&gt;</p></font>Tue, 29 Jan 2008 02:53:21 Z2008-01-29T02:53:21Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#b3c80621-c0dd-410e-aa2f-3c8d3cd3b252http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#b3c80621-c0dd-410e-aa2f-3c8d3cd3b252AWolffhttp://social.msdn.microsoft.com/Profile/en-US/?user=AWolffLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'<span><span id="_ctl0_MainContent__ctl0_PostForm_ReplyBody"> <p>submit this line into query analyzer on master or your database to grant access:</p> <p>sp_grantlogin 'NT AUTHORITY\NETWORK SERVICE'</p><br> <p><br></p> <p>Thanks Tommy123456, that did the trick for me.  I also had to open that user in SQL and point them towards the appropriate database for my particular case.  <br></p> <p> </p></span></span>Fri, 01 Feb 2008 20:11:02 Z2008-02-01T20:11:02Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#d6a16f5e-b0a2-4fe5-b593-41d38b632d5chttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#d6a16f5e-b0a2-4fe5-b593-41d38b632d5cpeonysmileshttp://social.msdn.microsoft.com/Profile/en-US/?user=peonysmilesLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'<p>Well I followed the instructions above; I am running sql server 2005 enterprise; below is my conncetion string:</p> <p align=left> </p> <p align=left>&lt;add key=&quot;DatabaseProposals1&quot; value=&quot;Provider=SQLOLEDB;Data Source=RGV-BOS-BL2;Database=Proposals;Integrated Security=SSPI;&quot;/&gt;<br>   </p> <p align=left><font face=Arial size=2></font> </p>Fri, 15 Feb 2008 15:50:57 Z2008-02-15T15:50:57Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#3eb80671-d5be-414c-ac3b-78000f1ccdcdhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#3eb80671-d5be-414c-ac3b-78000f1ccdcdrasberry81http://social.msdn.microsoft.com/Profile/en-US/?user=rasberry81Login failed for user 'NT AUTHORITY\NETWORK SERVICE'<div>i also face the same problem, Login failed for user 'NT AUTHORITY\NETWORK SERVICE'. i like to try with tommy's idea but how can i change the grant access for my aspnetdb database. i could not find it. i only have database master, model &amp; tempdb. why my aspnetdb.mdf is not detected?.  i tested the connection at web admin tool. the connection is success. </div> <div align=left> </div> <div align=left>another wierd thing is i can view my page (client.aspx) using localhost but when i use IP address <a title="http://231.222.170.244/client.aspx" href="http://231.222.170.244/client.aspx">http://231.222.170.244/client.aspx</a>, i got error login failed for user 'NT AUTHORITY\NETWORK SERVICE'. please help me to solve this. tQ </div> <div align=left><font face=Arial size=2></font> </div>Wed, 26 Mar 2008 02:05:41 Z2008-03-26T02:05:41Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#56d9e0c2-e603-4ca5-8874-f6609e245ac1http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#56d9e0c2-e603-4ca5-8874-f6609e245ac1peonysmileshttp://social.msdn.microsoft.com/Profile/en-US/?user=peonysmilesLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'<font face=Arial size=2> <p class=MsoNormal><span style="color:#1f497d"><font color="#000000">Hi,</font></span></p> <p class=MsoNormal align=left><span style="color:#1f497d"><font color="#000000">I got help from someone who knows this stuff inside and out.  They pointed me to these two white papers.  Hope that it helps.</font></span></p> <p class=MsoNormal align=left><span style="color:#1f497d"></span> </p> <p class=MsoNormal align=left><span style="color:#1f497d">The problem you are experiencing is an issue with how ASP.NET handles impersonation and access to remote resources.  One of the best solutions for this is to run your web service in the context of a domain user that has access to all the resources that are needed, and do not impersonate the client.  This means your domain user will need to have access to both the remote machine where it is creating directories and have access to the database to update records.</span></p> <p class=MsoNormal><span style="color:#1f497d"> </span></p> <p class=MsoNormal><span style="color:#1f497d">This issue in ASP.NET is well discuss in these two documents, from identifying the issue of identity management to designing solutions based around the infrastructure in place:</span></p> <p class=msolistparagraph0 style="text-indent:-0.25in"><span style="color:#1f497d"><span style="">-<span style="font:7pt 'Times New Roman'">          </span></span></span><span style="color:#1f497d"><a title="http://www.microsoft.com/technet/security/guidance/identitymanagement/idmanage/P3ASPD.mspx?mfr=true" href="http://www.microsoft.com/technet/security/guidance/identitymanagement/idmanage/P3ASPD.mspx?mfr=true">http://www.microsoft.com/technet/security/guidance/identitymanagement/idmanage/P3ASPD.mspx?mfr=true</a></span></p> <p class=msolistparagraph0 style="text-indent:-0.25in"><span style="color:#1f497d"><span style="">-<span style="font:7pt 'Times New Roman'">          </span></span></span><span style="color:#1f497d"><a title="http://msdn2.microsoft.com/en-us/library/aa291350.aspx" href="http://msdn2.microsoft.com/en-us/library/aa291350.aspx">http://msdn2.microsoft.com/en-us/library/aa291350.aspx</a></span></p></font>Wed, 26 Mar 2008 15:09:26 Z2008-03-26T15:09:26Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#c792ccb7-344e-4637-9c59-802de067f471http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#c792ccb7-344e-4637-9c59-802de067f471Lokesh Kumar Tanwarhttp://social.msdn.microsoft.com/Profile/en-US/?user=Lokesh%20Kumar%20TanwarLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'if,  you acess it in system like intranet, then delete <strong>Intigrated Security</strong> from connection string or set it off and specify <strong>user id, password </strong>of sql-server authentication <p align=left><font face=Arial size=2></font> </p>Mon, 19 May 2008 07:11:19 Z2008-05-19T07:11:19Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#5d0284c9-5e00-4c99-88d4-a16515aeb8fahttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#5d0284c9-5e00-4c99-88d4-a16515aeb8fakeiyiahttp://social.msdn.microsoft.com/Profile/en-US/?user=keiyiaLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'<p align=left><font face=Arial size=2></font> </p>Thank you, thank you, thank you, tommy123456 and VegasDave.  The combination of your posts worked for me.Thu, 03 Jul 2008 14:03:36 Z2008-07-03T14:03:36Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#f7711b50-3e4b-42cf-8c1f-92962ececa7chttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#f7711b50-3e4b-42cf-8c1f-92962ececa7cDeezeryhttp://social.msdn.microsoft.com/Profile/en-US/?user=DeezeryLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'Your connection string is wrong. Meaning you wanted to use SQL authentication but for some reason it is using Integrated Security  <a title="http://seerchet.com" href="http://seerchet.com">.</a><a title="http://yewuee.com" href="http://yewuee.com">.</a><a title="http://artkles.com" href="http://artkles.com">.</a><a title="http://buigg.com" href="http://buigg.com">.</a>Sat, 05 Jul 2008 20:16:55 Z2008-07-05T20:16:55Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#8aba002f-8f75-404e-83d8-f3f06edf162dhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#8aba002f-8f75-404e-83d8-f3f06edf162dalps2210http://social.msdn.microsoft.com/Profile/en-US/?user=alps2210Login failed for user 'NT AUTHORITY\NETWORK SERVICE'<div class=quote> <table width="85%"> <tbody> <tr> <td class=txt4> <strong>VegasDave wrote:</strong></td></tr> <tr> <td class=quoteTable> <table width="100%"> <tbody> <tr> <td class=txt4 valign=top width="100%"><font face="Times New Roman"></font> <p align=left><font face=Arial size=2>Thank you, thank you, thank you, tommy123456.  I've been beating on this all day and your solution works like a charm!  After running :</font></p> <p align=left><font face=Arial size=2></font> </p> <p align=left><font face=Arial size=2>sp_grantlogin 'NT AUTHORITY\NETWORK SERVICE' </font></p> <p align=left><font face=Arial size=2></font> </p> <p align=left><font face=Arial size=2>in query analyzer against both master and my database, and turning on Role Membership for all ASP roles plus db_datareader and db_datawriter, I finally got past that annoyning login failed error message.</font></p> <p align=left> </p> <p align=left>pls tell me  whatever  u did in  detailed procedure bcoz i am very  new  to  sql server  2000. <br></p></td></tr></tbody></table></td></tr></tbody></table></div>Fri, 01 Aug 2008 09:58:11 Z2008-08-01T09:58:11Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#d513a685-31c1-4dfb-b47c-4ecff8f113c4http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#d513a685-31c1-4dfb-b47c-4ecff8f113c4alps2210http://social.msdn.microsoft.com/Profile/en-US/?user=alps2210Login failed for user 'NT AUTHORITY\NETWORK SERVICE'pls tell me this thing in detail procedure bcoz i am new to sql server 2000.<br>Fri, 01 Aug 2008 10:13:12 Z2008-08-01T10:13:12Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#b3674180-e067-45ff-81b8-39e6d3822422http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#b3674180-e067-45ff-81b8-39e6d3822422aliziveiehttp://social.msdn.microsoft.com/Profile/en-US/?user=aliziveieLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'<div align=left><font face=Arial size=2>When you have created virtual directory of your application created in .Net2.0 and application is not running.<br>Even everything is fine in web.config, still it is giving error in web.config file.</font></div> <div> </div> <div align=left><font face=Arial size=2>Error :- The current identity (NT AUTHORITY\NETWORK SERVICE) does not have write access to 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files'. </font></div> <div> </div> <div align=left><font face=Arial size=2>Solution is <br>goto command prompt then navigate to directory</font></div> <div> </div> <div align=left><font face=Arial size=2>C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727</font></div> <div> </div> <div align=left><font face=Arial size=2>Now run this command</font></div> <div> </div> <div align=left><font face=Arial size=2>aspnet_regiis -ga &quot;NT AUTHORITY\NETWORK SERVICE&quot;</font></div> <div> </div> <div align=left><font face=Arial size=2>Everything will wok fine.</font></div>Wed, 12 Nov 2008 20:03:53 Z2008-11-12T20:03:53Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#39519e61-9fb2-490a-a1c8-90db7b96e2d4http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#39519e61-9fb2-490a-a1c8-90db7b96e2d4Closh_Losthttp://social.msdn.microsoft.com/Profile/en-US/?user=Closh_LostLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'<p align=left><font face=Arial size=2></font> </p> <p>I think this is not a solution , because I would need to give different right of database accessing to the different users who connect to the web site.</p> <p align=left>I  retrieve the user straight away from Windows authentication , so i need to give it an access to the database with his user and not 'NT AUTHORITY\NETWORK SERVICE' .</p> <p align=left>Could someone help me?</p>Wed, 19 Nov 2008 00:47:35 Z2008-11-19T00:47:35Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#066f5103-198a-4893-9fd3-221913e327a9http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#066f5103-198a-4893-9fd3-221913e327a9Venu Babuhttp://social.msdn.microsoft.com/Profile/en-US/?user=Venu%20BabuLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'Hi Closh,<br><br>As per my experience ASP.Net is not able to get windows authentication till you have specified Impersonate. Even if we are maintaining Windows authentication at IIS level, I am not able to get Windows logon username when authentication is happening with Sql Server.<br><br>If I really need to authenticate user under Windows in asp.net, Enable Impersonate as:<br><pre class=libCScode style="white-space:pre-wrap">&lt;identity impersonate=&quot;true&quot;<br> userName=&quot;domain\user&quot; <br> password=&quot;password&quot; /&gt;<br><br>Now ASPNet will run under specified username instead of default ASPNET User Account (DomainName\MachineName).<br><br>Try to understand <br></pre><h3 class=dtH3>ASP.NET Process Identity in <a href="http://msdn.microsoft.com/en-us/library/aa291350.aspx">http://msdn.microsoft.com/en-us/library/aa291350.aspx</a></h3><br>Thank You.<br>Wed, 17 Dec 2008 21:56:55 Z2008-12-17T21:56:55Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#2b0b6197-e508-4c93-a464-a0d9dc8e7d56http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#2b0b6197-e508-4c93-a464-a0d9dc8e7d56Ramzan Sadiqhttp://social.msdn.microsoft.com/Profile/en-US/?user=Ramzan%20SadiqLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'thanks thanks thanks <font class=postedBy><a title=Sidheshwar href="http://social.msdn.microsoft.com/en-US/profile/?user=Sidheshwar&amp;referrer=http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407/"><font color="#0072bc">Sidheshwar</font></a> it worked for me.<br><br>RS<br><br></font>Tue, 30 Dec 2008 02:26:20 Z2008-12-30T02:26:20Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#b99602ed-0488-418e-b292-717c02856d40http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#b99602ed-0488-418e-b292-717c02856d40ajade101http://social.msdn.microsoft.com/Profile/en-US/?user=ajade101Login failed for user 'NT AUTHORITY\NETWORK SERVICE' Hi Cinni,<br><br>Would you be more specific? my email is &quot;Akshay Patel&quot; <a href="mailto:ajade101@yahoo.com">ajade101@yahoo.com</a>Mon, 09 Mar 2009 21:03:18 Z2009-03-09T21:03:18Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#bbdc2263-1d0c-46f9-9c0f-9c340d3a8643http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#bbdc2263-1d0c-46f9-9c0f-9c340d3a8643Mandar Patkihttp://social.msdn.microsoft.com/Profile/en-US/?user=Mandar%20PatkiLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'This worked for me! Thanks! Only difference, I need to set the server role to 'sysadmin' for NT AUTHORITY/NETWORK SERVICE<hr class="sig">DeveloperThu, 11 Jun 2009 09:46:46 Z2009-06-11T09:46:46Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#2eb73ad5-caa2-40e4-9659-92ab64724011http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#2eb73ad5-caa2-40e4-9659-92ab64724011Yin Liehttp://social.msdn.microsoft.com/Profile/en-US/?user=Yin%20LieLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'<p class=MsoNormal style="margin:0in 0in 0pt"><span style="color:black;font-family:'Comic Sans MS'"><br/><br/><span style="font-size:small">I just have the same problem.<br/>And wants to use this solution, but DB Admin not allowed.<br/><br/>Just make sure that </span></span><span style="color:#a31515;font-family:'Comic Sans MS'"><span style="font-size:small">Persist Security Info=True</span></span><span style="font-size:small"><span style="color:black;font-family:'Comic Sans MS'">, when user &amp; password need to be set.<br/>This works.<br/><br/>It is better &amp; secure way</span><span style="font-family:Arial"></span></span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Times New Roman"> </span></p>Mon, 29 Jun 2009 03:26:03 Z2009-06-29T03:26:03Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#8d555767-6c8d-4339-849e-afbdea36d096http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#8d555767-6c8d-4339-849e-afbdea36d096yousufkhanhttp://social.msdn.microsoft.com/Profile/en-US/?user=yousufkhanLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'<p>write below line in new query window<br/><br/><br/>sp_grantlogin 'NT AUTHORITY\NETWORK SERVICE'<br/><br/>run it under your database and also under master<br/><br/><br/>On your Particular Database follow the below step<br/><br/>go to security -&gt; Users -&gt; NT AUTHORITY\NETWORK SERVICE -&gt;Right Click -&gt; Properties -&gt; Check datareader, datawriter</p>Thu, 01 Oct 2009 20:07:45 Z2009-11-16T20:25:13Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#9ae8f786-16c3-4848-a494-3229a1340265http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#9ae8f786-16c3-4848-a494-3229a1340265Nic Martelhttp://social.msdn.microsoft.com/Profile/en-US/?user=Nic%20MartelLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'<p>.<br/><strong>I give up...</strong> If this post does not result in a solution for me, I am dropping Microsoft SQLServer<br/>I have tried so many combinations, I don't know what is what anymore.<br/>My site connection worked great under WINDOWS XP Pro, I can't get it to work under <strong>WINDOWS 7 Pro<br/></strong>Fails at the <strong>Conn.Open</strong> statement.<br/><br/><strong>My small contribution:</strong> (This maybe or may not be related, but a good thing to know)<br/>If anyone has had the nagging Visual Studio Debugger Timing out problem, here is what I ran into:<br/>If the <strong>DefaultAppPool</strong> in IIS7 is set to:<br/>    - Managed Pipeline Mode=<strong>Integrated  </strong>(if change that to <strong>Classic </strong>...debugger starts timing out again)<br/>    - Identity=<strong>NetworkService  </strong>(if change that to <strong>LocalSystem </strong>...debugger starts timing out again)<br/><span style="text-decoration:underline">the Visual Studio Debugger no longer times out after 1+ minute</span>.<br/><br/><strong>THE MAIN ISSUE:</strong><br/>I have WINDOWS 7 Pro<br/>          IIS 7 and IIS7 Manager<br/>          Visual Studio 2008<br/>          SQLServer EXPRESS 2005<br/>          SQLServer Express Management Studio.<br/>          .NET Framework 2.xxx (3.5)<br/><strong><br/>Connecting to database via ASP.NET site fails:</strong><br/>Many of the  options stated in above posts are not showing up on the WINDOWS 7 Pro, IIS 7, or the <strong>SQLServer Management Studio</strong>. I have to interpret them into what I see on WIN 7...<br/>I have created the NetworkService User in SQLServer and set Full COntrol on the rootFolder of the Website(Folder where the project resides... and it shows under IIS)<br/>My DB.mdf resides at: (I believe this is the 64-Bit side)<br/><span style="color:#008000;font-size:xx-small"><span style="color:#008000;font-size:xx-small"><span style="font-family:Verdana;color:green;font-size:10pt">     C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\Data\MyDB.mdf<br/></span><br/></span></span><strong>WINDOWS 7 Pro base</strong>:<br/>The MyDB.mdf and MyDB.ldf were copied from the previous XP Pro installation to this New WINDOWS 7 Pro setup.<br/><strong>SQLServer Explorer in Visual Studio and SQLServer 2005 Management Studio BOTH connect and allow management of the database. no problems,</strong> NO MATTER WHAT CHANGES I MAKE TO IIS.<br/><br/>If you say adjust this role to this and that... I will not know what it means.<br/>I need a step by step, <strong>go here</strong>, <strong>set to that</strong> type help. (Thank you)<br/>Will anyone please provide a simple list of all the settings that need to be addressed to establish a successful database connection/login via the website. The website functions smoothly in all respects except for the connection to the database.<br/><strong><br/>IIS 7:  DefaultAppPool, Advanced settings etc...</strong><br/>  I choose not to list all options to avoid confusion as to which should be addressed and which need not.<br/>  Provide complete list and corresponding settings, please. (Thank you)<br/><br/><strong>SQLServer 2005 Management Studio...</strong><br/>If you say adjust this role to this and that... I will not know what it means.<br/>I need a step by step, <strong>go here</strong>, <strong>set to that</strong> type help. (Thank you)<br/><br/><strong>Connection String tag=value list...</strong><br/>I wanted to connect without using a user in the database(WINDOWS AUTHENTICATION I assumed) but I am starting to think it is not possible.<br/>What does the NetworkService connect to? SQLServer? ALL databases?<br/>Do I have to include My Windows Login account as a user in SQL?<br/><br/>2 of the 50 scenarios I have tried:<br/><span style="font-family:Verdana;color:red;font-size:10pt">__________________________________________________________________<br/></span><span style="font-family:Verdana;color:red;font-size:10pt">AppPool Identity: <strong>NetworkService</strong><br/></span><span style="font-family:Verdana;color:red;font-size:10pt">Managed Pipeline Mode: <strong>Classic</strong> (causes debugger to time out after 1+ minute!)<br/></span><span style="font-family:Verdana;color:blue;font-size:9pt">&lt;</span><span style="font-family:Verdana;color:#a31515;font-size:9pt">add</span><span style="font-family:Verdana;color:blue;font-size:9pt"> </span><span style="font-family:Verdana;color:red;font-size:9pt">connectionString</span><span style="font-family:Verdana;color:blue;font-size:9pt">=</span><span style="font-family:Verdana;font-size:9pt">&quot;<span style="color:blue">Server=MYCOMPUTER\SQLExpress;Database=MyDB.mdf;Integrated Security=<strong>true</strong></span>&quot;<span style="color:blue"> </span><span style="color:red">name</span><span style="color:blue">=</span>&quot;<span style="color:blue">MYWEBSITE.My.MySettings.ConnString</span>&quot;<span style="color:blue"> </span><span style="color:red">providerName</span><span style="color:blue">=</span>&quot;<span style="color:blue">.NET Framework Data Provider for SQL Server</span>&quot;<span style="color:blue"> /&gt;<br/></span></span><strong><span style="font-family:Verdana;color:red;font-size:10pt">Error:</span></strong><span style="font-family:Verdana;color:red;font-size:10pt"><span>  </span>Cannot open database &quot;MyDB.mdf&quot; requested by the login. The login failed. Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.<br/></span><span style="font-family:Verdana;color:red;font-size:10pt">__________________________________________________________________<br/></span><span style="font-family:Verdana;color:red;font-size:10pt">AppPool Identity: <strong>NetworkService</strong><br/></span><span style="font-family:Verdana;color:red;font-size:10pt">Managed Pipeline Mode: <strong>Integrated</strong> (Debugger no longer times out after 1+ minute, stays on till stopped)<br/></span><span style="font-family:Verdana;color:blue;font-size:9pt">&lt;</span><span style="font-family:Verdana;color:#a31515;font-size:9pt">add</span><span style="font-family:Verdana;color:blue;font-size:9pt"> </span><span style="font-family:Verdana;color:red;font-size:9pt">connectionString</span><span style="font-family:Verdana;color:blue;font-size:9pt">=</span><span style="font-family:Verdana;font-size:9pt">&quot;<span style="color:blue">Server=MYCOMPUTER\SQLExpress;Database=MyDB.mdf;Integrated Security=<strong>false</strong></span>&quot;<span style="color:blue"> </span><span style="color:red">name</span><span style="color:blue">=</span>&quot;<span style="color:blue">MYWEBSITE.My.MySettings.ConnString</span>&quot;<span style="color:blue"> </span><span style="color:red">providerName</span><span style="color:blue">=</span>&quot;<span style="color:blue">.NET Framework Data Provider for SQL Server</span>&quot;<span style="color:blue"> /&gt;<br/></span></span><strong><span style="font-family:Verdana;color:red;font-size:10pt">Error:</span></strong><span style="font-family:Verdana;color:red;font-size:10pt"><span>  </span>Login failed for user ''. The user is not associated with a trusted SQL Server connection.<br/></span><span style="font-family:Verdana;color:red;font-size:10pt"><span style="font-family:Verdana;color:red;font-size:10pt"><br/>__________________________________________________________________<br/><span style="font-family:Verdana;color:red;font-size:10pt">AppPool Identity: <strong>NetworkService</strong><br/></span><span style="font-family:Verdana;color:red;font-size:10pt">Managed Pipeline Mode: <strong>Integrated</strong> (Debugger no longer times out after 1+ minute, stays on till stopped)<br/></span><span style="font-family:Verdana;color:blue;font-size:9pt">&lt;</span><span style="font-family:Verdana;color:#a31515;font-size:9pt">add</span><span style="font-family:Verdana;color:blue;font-size:9pt"> </span><span style="font-family:Verdana;color:red;font-size:9pt">connectionString</span><span style="font-family:Verdana;color:blue;font-size:9pt">=</span><span style="font-family:Verdana;font-size:9pt"><span style="color:#000000">&quot;</span><span style="color:blue">Server=MYCOMPUTER\SQLExpress;Database=MyDB.mdf;Integrated Security=<strong>true</strong></span><span style="color:#000000">&quot;</span><span style="color:blue"> </span><span style="color:red">name</span><span style="color:blue">=</span><span style="color:#000000">&quot;</span><span style="color:blue">MYWEBSITE.My.MySettings.ConnString</span><span style="color:#000000">&quot;</span><span style="color:blue"> </span><span style="color:red">providerName</span><span style="color:blue">=&quot;System.Data.SQLClient</span><span style="color:#000000">&quot;</span><span style="color:blue"> /&gt;<br/></span></span><strong><span style="font-family:Verdana;color:red;font-size:10pt">Error:</span></strong><span style="font-family:Verdana;color:red;font-size:10pt"><span>  </span></span></span>Cannot open database &quot;MyDB.mdf&quot; requested by the login. The login failed.<br/>Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.<br/>__________________________________________________________________<br/><span style="font-family:Verdana;color:red;font-size:10pt">AppPool Identity: <strong>NetworkService</strong><br/></span><span style="font-family:Verdana;color:red;font-size:10pt">Managed Pipeline Mode: <strong>Integrated</strong> (Debugger no longer times out after 1+ minute, stays on till stopped)<br/></span><span style="font-family:Verdana;color:blue;font-size:9pt">&lt;</span><span style="font-family:Verdana;color:#a31515;font-size:9pt">add</span><span style="font-family:Verdana;color:blue;font-size:9pt"> </span><span style="font-family:Verdana;color:red;font-size:9pt">connectionString</span><span style="font-family:Verdana;color:blue;font-size:9pt">=</span><span style="font-family:Verdana;font-size:9pt"><span style="color:#000000">&quot;</span><span style="color:blue">Server=MYCOMPUTER\SQLExpress;Database=MyDB.mdf;Integrated Security=<strong>false</strong></span><span style="color:#000000">&quot;</span><span style="color:blue"> </span><span style="color:red">name</span><span style="color:blue">=</span><span style="color:#000000">&quot;</span><span style="color:blue">MYWEBSITE.My.MySettings.ConnString</span><span style="color:#000000">&quot;</span><span style="color:blue"> </span><span style="color:red">providerName</span><span style="color:blue">=&quot;System.Data.SQLClient</span><span style="color:#000000">&quot;</span><span style="color:blue"> /&gt;<br/></span></span><strong><span style="font-family:Verdana;color:red;font-size:10pt">Error:</span></strong><span style="font-family:Verdana;color:red;font-size:10pt"><span>  </span></span>Login failed for user ''. The user is not associated with a trusted SQL Server connection.<br/><span style="font-family:Verdana;color:red;font-size:10pt">__________________________________________________________________<br/></span></span><br/>Thank you anyone in advance.<br/>.</p> <hr class=sig> SPASat, 21 Nov 2009 19:40:55 Z2009-11-21T19:47:23Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#caff1a43-7638-4496-a776-e05d5b707918http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/a31656a9-5715-4910-ad96-fa590344a407#caff1a43-7638-4496-a776-e05d5b707918yousufkhanhttp://social.msdn.microsoft.com/Profile/en-US/?user=yousufkhanLogin failed for user 'NT AUTHORITY\NETWORK SERVICE'write below line in new query window<br/><br/><br/>sp_grantlogin 'NT AUTHORITY\NETWORK SERVICE'<br/><br/>run it under your database and also under master<br/><br/><br/>On your MyDB in SQL Server Management Studio under Security tab do the following<br/><br/>if a user like <span style="color:#ff0000;font-size:x-small">NT AUTHORITY\NETWORK SERVICE</span><br/>is not present <br/><br/>if present db_datareader and db_datawriter must be checked<br/><br/>security -&gt; Users -&gt; Right Click-&gt;  New User<br/><br/>Write User Name and Login Name both as <span style="color:#ff0000;font-size:x-small">NT AUTHORITY\NETWORK SERVICE<br/></span><br/>Dont forget to check db_datareader and db_datawriter both in Owned Schemas and Database role membership windows -&gt;OK<br/><br/><br/><span style="color:#008000;font-size:x-small">C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\Data\MyDB.mdf</span><br/> <br/>Right Click the folder Data from above path<br/><br/>Right Click -&gt; Properties -&gt; Security -&gt; Edit -&gt;Check Full Control for all Users<br/><br/>Users like SYSTEM etc<br/><br/><br/><br/><br/><br/><br/>Mon, 23 Nov 2009 16:24:02 Z2009-11-23T16:24:02Z