How do I get my ASP.Net MVC2 application to authenticate with the SQL Server using Sql Authentication?
我在Windows Server 2008 IIS7服务器上部署了ASP.net MVC 2应用程序,它炸毁了报告:
Login failed for user 'NT AUTHORITY\\ANONYMOUS LOGON'.
我在服务器上启用了SQL Server身份验证,并且已经为我要访问的数据库创建了登录名。 我不明白为什么要使用" NT AUTHORITY \ ANONYMOUS LOGON"
正在使用凭据。 这必须是应用程序在其中运行的上下文(应用程序池)。 我假设应用程序将只使用在连接字符串中指定的凭据。 如何将IIS7和/或ASP.net配置为仅使用用户登录并传递web.config中指定的连接字符串中提供的?
万分感谢。
我很确定问题出在SQL Server或IIS配置上。 该应用程序可以从我的开发机器上运行。
连接字符串:
connectionString="Data Source=servername;Initial Catalog=TestPortal;User Id=username;Password=password;"
默认情况下,Entity Framework连接字符串具有:
Integrated Security=True;
这应该从asp.net成员资格提供程序的连接字符串以及实体框架的生成的连接字符串中删除。
您的连接字符串应如下所示:
1 | Data Source=SomeServerName;Initial Catalog=SomeDB;User Id=user;Password=pwd; |
并且必须在SQL Server上启用SQL身份验证。