简体   繁体   English

更改Web应用程序身份验证以使用Windows身份验证

[英]change web application authentication to use Windows Authentication

I'm trying to publish my web application on IIS 8.5, but I'm getting this error when the application tries to retrieve data from the SQL Server 2008. 我正在尝试在IIS 8.5上发布Web应用程序,但是当应用程序尝试从SQL Server 2008检索数据时出现此错误。

InnerException: {Message:An error has occurred., ExceptionMessage:Login failed for user 'domainname\\WES-JXC2J02$'.,…} ExceptionMessage: "Login failed for user 'domainname\\WES-JXC2J02$'." InnerException:{消息:发生错误。,ExceptionMessage:用户'domainname \\ WES-JXC2J02 $'登录失败。,…} ExceptionMessage:“用户'domainname \\ WES-JXC2J02 $'登录失败。

The SQL Server doesn't have WES-JXC2J02$ listed as the authorized user because it's my dev machine name. SQL Server没有将WES-JXC2J02 $列为授权用户,因为它是我的开发机名称。 If I try to add the machine name as user in SQL Server it gives me an error because there's no such user in the domain. 如果我尝试将计算机名称添加为SQL Server中的用户,则会出现错误,因为域中没有此类用户。 I want to use Windows Authentication which is set to enable in IIS. 我想使用Windows身份验证,该身份验证设置为在IIS中启用。 What can I do to fix it? 我该如何解决?

So, apparently, as @MikeCheel said, it was forwarding my machine credentials to the SQL Server to retrieve the data from the database. 因此,显然,正如@MikeCheel所说,它正在将我的计算机凭据转发到SQL Server,以从数据库中检索数据。 Turned out, I needed to create a new login in SQL Server with limited access, then add the user id and password in the connectionString. 原来,我需要在访问受限的SQL Server中创建一个新的登录名,然后在connectionString中添加用户ID和密码。 I learnt it the hard way that SQL Server must have SQL and Windows Authentication enabled. 我很难理解SQL Server必须启用SQL和Windows身份验证。 Once that was configured, connection was setup and the data displayed properly. 配置完成后,就建立了连接并且数据正确显示。

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

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