如何设置显式 NetworkCredential 以对工作组计算机而不是域进行身份验证
我使用以下形式的 NetworkCredential 构造函数在调用需要特定身份的 Web 服务之前设置显式凭据:
myWebService.Credentials = new System.Net.NetworkCredential(userName, password, domain);
这在我们的 IIS 6.0 开发和 IIS 7.5 临时环境中运行良好,其中各种服务器是我们域的一部分。
现在,此代码已部署到生产环境中,其中服务器不属于域,而只是工作组的成员,并且正确的身份验证不起作用。在运行时,这种有效的替代是失败的:
myWebService.Credentials = new System.Net.NetworkCredential("localuserName", "XyZ!XyZ", "myServerName");
我没有对这些不同工作组计算机的完全访问权限,并且在那里进行配置的系统管理员似乎已经正确设置了本地帐户和应用程序池。
那么,综上所述,是否可以通过简单地使用服务器名称而不是域名来继续在 WORKGROUP 中使用上述技术?如果代码在任何一种情况下都可以工作,那么一定存在其他一些配置问题,我将不得不追查有关该问题的更多信息。
I am using the following form of the NetworkCredential constructor to set explicit credentials before invoking a webservice that requires a specific identity:
myWebService.Credentials = new System.Net.NetworkCredential(userName, password, domain);
This has been working fine in our IIS 6.0 development and IIS 7.5 staging environments where the various servers are part of our domain.
Now this code has been deployed to a production environment where the servers are NOT part of a domain but just members of a WORKGROUP and the proper authentication is not working. At runtime, this effective substitution is failing:
myWebService.Credentials = new System.Net.NetworkCredential("localuserName", "XyZ!XyZ", "myServerName");
I don't have complete access to these various workgroup machines and the sysadmin who configured things there appears to have set up the local accounts and application pools correctly.
So, in summary, can use of the above technique continue to work in a WORKGROUP by simply using the name of the server instead of the domain name? If the code should work in either case, then there must be some other configuration problem where I will have to chase down more information on the problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有关此主题的更多信息,请查看以下链接
本部分:将身份验证凭据传递到 Web 服务
http://msdn.microsoft .com/en-us/library/ff649362.aspx#secnetch10_usingclientcertificates
希望这会有所帮助。
for more information about this subjects have look on following link
this section: Passing Credentials for Authentication to Web Services
http://msdn.microsoft.com/en-us/library/ff649362.aspx#secnetch10_usingclientcertificates
hope this could be helpful.