简体   繁体   English

配置IIS 8以进行SQL Server身份验证

[英]Configure IIS 8 for SQL Server Authentication

I'm getting the following error when trying to query SQL Server 2012 from Windows 2012 IIS 8.5, in an MVC 4 website: 在MVC 4网站中尝试从Windows 2012 IIS 8.5查询SQL Server 2012时出现以下错误:

SqlException (0x80131904): Login failed for user [domain/user] SqlException(0x80131904):用户[域/用户]登录失败

I have the connection string in Web.config set up just the way we did it back in the olden days: 我在Web.config中设置了连接字符串,就像以前一样:

<add name="MYPROJECT.Properties.Settings.defaultConn" connectionString="Data Source=MYSERVER;Initial Catalog=MYDATABASE;Persist Security Info=True;User ID=MYUSER;Password=MYPASSWORD"

IIS8 seems to be using an Application Pool to login, bypassing the connectionstring in Web.config. IIS8似乎正在使用应用程序池登录,从而绕过Web.config中的连接字符串。

Database and Website are on different servers. 数据库和网站位于不同的服务器上。 Is there a straightforward way that I can configure IIS to bypass the Application Pool and read the connectionstring from Web.config? 有没有一种简单的方法可以配置IIS绕过应用程序池并从Web.config中读取连接字符串?

If Persist security info is set to true, it will be ignored. 如果将Persist安全信息设置为true,它将被忽略。 From MSDN MSDN

The ConnectionString is similar to an OLE DB connection string, but is not identical. ConnectionString与OLE DB连接字符串相似,但不相同。 Unlike OLE DB or ADO, the connection string that is returned is the same as the user-set ConnectionString, minus security information if the Persist Security Info value is set to false (default). 与OLE DB或ADO不同,返回的连接字符串与用户设置的ConnectionString相同,如果Persist Security Info值设置为false(默认值),则减去安全信息。 The .NET Framework Data Provider for SQL Server does not persist or return the password in a connection string unless you set Persist Security Info to true. 除非将Persist Security Info设置为true,否则SQL Server的.NET Framework数据提供程序不会持续存在或在连接字符串中返回密码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM