简体   繁体   English

在ASP.Net AJAX中使用Windows身份验证

[英]Use windows authentication with ASP.Net AJAX

I'm working on my first application using ASP.Net with web services and I'm having an authentication issue. 我正在使用带有Web服务的ASP.Net开发我的第一个应用程序,并且遇到了身份验证问题。 At least I think that's the issue. 至少我认为这是问题所在。

When I run the application locally in debug mode it works fine. 当我在调试模式下本地运行应用程序时,它可以正常工作。 It even works when I run it out of debug mode (through IIS) in IE 7. But when I have a coworker run it (from my IIS) on their box, it doesn't work. 当我在IE 7中以调试模式(通过IIS)运行它时,它甚至可以工作。但是当我有一个同事(在我的IIS中)在他们的盒子上运行它时,它不起作用。 When querying active directory to look up users it gives this error: 查询活动目录以查找用户时,会出现以下错误:

Sys.Net.WebServiceFailedException: The server method 'GetCurrentUser' failed with the following error: System.Runtime.InteropServices.COMException - An operations error has occurred. Sys.Net.WebServiceFailedException:服务器方法'GetCurrentUser'失败,出现以下错误:System.Runtime.InteropServices.COMException-发生操作错误。

What do I need to do to get this working remotely? 我需要做什么才能使它远程工作?

Ensure IE is correctly identifying the zone as the Intranet so it will automatically send the username for it. 确保IE正确将区域标识为Intranet,以便它将自动发送该区域的用户名。 If its not, you'll need to manually add the URL to the Intranet Zone in the IE settings. 如果不是,则需要在IE设置中将URL手动添加到Intranet区域。

That should resolve it, and depending on your config you may need to add to your web.config 那应该可以解决它,根据您的配置,您可能需要将其添加到web.config中

What is your web.config for the webservice 您对Web服务的web.config是什么

What is the authentication setting for the website in IIS? IIS中网站的身份验证设置是什么? Unless it is set to Integrated Windows authentication it is not likely a permissions issue. 除非将其设置为“集成Windows身份验证”,否则不太可能出现权限问题。 If you want to rule out authentication, change the authentication method to Anonymous access and have your coworker try again. 如果要排除身份验证,请将身份验证方法更改为匿名访问,然后让您的同事再试一次。

Also, if you specify a user to impersonation in your web.config and you use a different user name in your active directory connection string it can cause an error but it is unclear if that is causing your issue. 另外,如果您在web.config中指定要模拟的用户,并且在活动目录连接字符串中使用其他用户名,则可能会导致错误,但尚不清楚是否是引起您问题的原因。

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

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