none
Linq to Sql - System.Data.SqlClient.SqlException: Login failed for user 'NT AUTHORITY\NETWORK SERVICE'. RRS feed

  • Question

  • I built some pages using Linq to Sql.  They work great locally but when I upload them to the server I get this error.

     

    System.Data.SqlClient.SqlException: Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

     

    I haven't seen and can't find anything about Linq and server permissions!  What's the deal?

    Friday, May 23, 2008 3:05 PM

Answers

  • I put the Linq-to-Sql .dbml files in another project.  I did not think to copy the connection string setting from the web site to this new project.  Once I did so it worked.

    Tuesday, May 27, 2008 12:50 PM

All replies

  • The issue most likely has to do with how ASP.NET handles impersonation and access to resources like SQL Server databases.

     

    Typically, you run your web pages in the security context of a domain user who has the necessary permissions to access the database.

     

    For details, see http://www.microsoft.com/technet/security/guidance/identitymanagement/idmanage/P3ASPD.mspx?mfr=true.

     

    Hope that helps,

     

    --Samir

     

     

    Friday, May 23, 2008 4:23 PM
  • I failed to mention that these new pages are within an existing intranet site which uses Windows authentication.  The rest of the site works fine but not the pages that use Linq-to-Sql.  If I replace the LinqDataSource with a SqlDataSource, it works fine.  Should not it use the same data access permissions for both types of data access controls?

    Tuesday, May 27, 2008 12:43 PM
  • I put the Linq-to-Sql .dbml files in another project.  I did not think to copy the connection string setting from the web site to this new project.  Once I did so it worked.

    Tuesday, May 27, 2008 12:50 PM