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中,右键单击匿名身份验证>编辑…>检查应用程序池标识(在我的情况下是域帐户)或输入特定用户的域帐户. (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- 如何保护我的ASP.NET AJAX应用程序?
- asp.net-mvc-3 – SQL Server 2008连接字符串,用于实体框架
- asp.net-mvc – 如何跳过ActionFilter的操作执行?
- .net – .ToTitleCase不适用于所有大写字符串
- 在IIS 7.5上运行的ASP.NET应用程序上强制Https
- asp.net – 在将MVC和路由添加到WebForms项目后,IIS中的默认
- asp.net-mvc – 将参数传递给Azure Active Directory身份验
- asp.net-mvc – 不显着的验证不工作在动态添加的局部视图
- asp.net – 表达式标记中的问题,用于绑定字符串变量
- asp.net – 强制IIS快速到经典管道模式
- 在当前的HTTPContext中生成一个新的ASP.NET会话
- asp.net-mvc – RavenDB Ids和ASP.NET MVC3路由
- asp.net – 我对Html.TextBoxFor的工作原理有什么
- asp.net – 如何在运行时更改页面位置
- asp.net-mvc – ASP.NET MVC Preview 5 on Mono
- 我可以使用ASP.NET成员身份实体框架吗?
- 使用ASP.NET Identity 2.0和MVC 5进行自定义单点
- asp.net-mvc-3 – asp.net mvc 3 razor从IEnumer
- asp.net-mvc – 在构建时尝试构建ASP MVC视图时出
- asp.net – 每个应用程序池的内存使用
