asp.net – 401客户端’协商’,服务器’协商,NTLM’调用WCF服务
好的,我已经读过每一个帖子&问题我可以找到这个错误,并且令人惊讶地没有找到解决方案.我试图在我的IIS托管的WCF服务(.NET 4.0)上要求
Windows身份验证,到目前为止,该服务是可选的.我已经在服务器上提供了一个启用Windows身份验证的端点,但有几个远程应用程序成功使用它.我现在正尝试将使用WCF服务的Web应用程序和其他服务器应用程序切换到此安全端点,方法是为它们提供与工作远程客户端完全相同的客户端配置,但服务器应用程序正在接收带有以下消息的401:
HTTP请求未经授权使用客户端身份验证方案“Negotiate”.从服务器收到的身份验证标头是“Negotiate,NTLM”.] 我为WCF托管站点启用了匿名和Windows身份验证.我开始使用的Web应用程序托管在与WCF服务不同的服务器上,并且运行在ASP.NET 2.0和Windows Server 2008 R2 Enterprise上.我用allowNtlm创建了一个客户端行为,并将NetworkSecurity:LAN Manager身份验证级别设置为Send LM& NTLM ……在客户端.在托管端,它被设置为发送NTLMv2仅响应…我不知道这是否会影响服务器/服务处理身份验证的方式.我也尝试在客户端上将allowedImpersonationLevel设置为Impersonation,幸运的是,它不起作用(因为模拟不应该是必要的).对于在与Web应用程序相同的服务器上运行的Windows服务和控制台应用程序,我们似乎得到了相同的结果. 这是我的服务器配置: <binding name="WindowsSecuredBinding"> <security mode="Transport"> <transport clientCredentialType="Windows" /> </security> </binding> ... <service behaviorConfiguration="OMWebServices.QueueServiceBehavior" name="OMWebServices.QueueService"> <endpoint address="" binding="basicHttpBinding" name="QueueEndpoint" bindingName="" contract="OMWebServices.IQueueService" /> <endpoint binding="basicHttpBinding" bindingConfiguration="WindowsSecuredBinding" name="QueueSecuredEndpoint" contract="OMWebServices.IQueueService" /> <endpoint address="mex" binding="mexHttpBinding" name="QueueMetadataEndpoint" contract="IMetadataExchange" /> </service> ... <behavior name="OMWebServices.QueueServiceBehavior"> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="true" /> </behavior> 这是客户端配置: <endpoint address="https://.../QueueService.svc" binding="basicHttpBinding" bindingConfiguration="QueueSecuredEndpoint" behaviorConfiguration="OMServiceBehavior" contract="OMQueueService.IQueueService" name="QueueSecuredEndpoint" /> <binding name="QueueSecuredEndpoint" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <security mode="Transport"> <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" /> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> </binding> .... <!-- The behavior I tried that didn't make a difference --> <behavior name="OMServiceBehavior"> <clientCredentials> <windows allowedImpersonationLevel="Impersonation" allowNtlm="True"/> </clientCredentials> </behavior> 我的第一个问题是,这个错误信息告诉我的是什么?它说客户端方案是Negotiate,服务器响应Negotiate,NTLM.如果服务器提供Negotiate并且客户端正在使用Negotiate,那么问题是什么? 第二个问题显然是错误的,我该如何使其发挥作用? 编辑 解决方法
要回答第一个问题,错误消息正在告诉我它的确切含义;我没有被授权.告诉我客户端身份验证方案和服务器头的这条线只是额外的信息,而不是冲突的指示.实际上确认配置是正确的.
在暂存环境中,问题被屏蔽,因为WCF服务和Web应用程序托管在同一服务器上.问题是Web应用程序的站点被配置为默认情况下为匿名用户使用IUSR(或IUSR_Server),一个本地帐户.这是正在传递的用户(我相信它等于CredentialCache.DefaultNetworkCredentials).当它们位于不同的服务器上时,服务器2上的WCF显然无法验证服务器1用户.解决方案是在IIS中,右键单击匿名身份验证>编辑…>检查应用程序池标识(在我的情况下是域帐户)或输入特定用户的域帐户. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- abp简单了解
- asp.net-mvc – 如何在web api中创建一个int []参数?
- asp.net-mvc-3 – 动态加载部分视图
- 从ASP.NET导出的word文件中添加页眉/页脚
- asp.net-mvc – 如何将asp.net mvc集成到Web站点项目中
- asp.net-mvc – ASP.NET MVC&Windsor.Castle:使用与Ht
- asp.net中数据库事务管理
- asp.net-mvc – 测试控制器使用User.Identity.Name的操作
- asp.net-mvc – 在ASP.NET MVC中使用ASP.NET Web窗体UserCo
- 检查是否在IIS中托管Asp.Net(Core)应用程序