Html HTTP 请求未经授权,客户端身份验证方案为“匿名”。从服务器收到的身份验证标头是“NTLM”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7677611/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'NTLM’
提问by SausageFingers
I have an ASP.NET web application written in VB.NET. One part of the application makes an AJAX call to an internal ASMX file which in turn makes a call to a remote web service which is just a single ASMX file. Normally this works fine and has been deployed a couple of times and works fine. One client however, is getting the message from the AJAX call:
我有一个用 VB.NET 编写的 ASP.NET Web 应用程序。应用程序的一部分对内部 ASMX 文件进行 AJAX 调用,该文件又对远程 Web 服务进行调用,该服务只是一个 ASMX 文件。通常这工作正常并且已经部署了几次并且工作正常。然而,一个客户端正在从 AJAX 调用中获取消息:
The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'NTLM'.
HTTP 请求未经授权,客户端身份验证方案为“匿名”。从服务器收到的身份验证标头是“NTLM”。
I have scoured a large amount of websites trying to fix this but I can't seem to find any answer that works for me.
我已经搜索了大量试图解决此问题的网站,但似乎找不到任何适合我的答案。
I have been unable to replicate the error on my test server, which is the same as the client, Win2003 IIS6.
我一直无法在我的测试服务器上复制错误,该服务器与客户端 Win2003 IIS6 相同。
The remote web service is deployed on Windows 2008 r2 – IIS7.5. The remote service is deployed using ‘Anonymous' authentication only. The client deployment is set up with Anonymous and ‘Integrated Windows Authentication'. I have tried changing the authentication levels on both implementations but cannot replicate the issue. The closest I have come is when I set the remote service IIS authentication to
远程 Web 服务部署在 Windows 2008 r2 – IIS7.5 上。仅使用“匿名”身份验证部署远程服务。客户端部署设置为匿名和“集成 Windows 身份验证”。我已尝试更改两种实现的身份验证级别,但无法复制该问题。我最接近的是当我将远程服务 IIS 身份验证设置为
The HTTP request is unauthorized with client authentication scheme 'Ntlm'. The authentication header received from the server was ''.
HTTP 请求未经客户端身份验证方案“Ntlm”授权。从服务器收到的身份验证标头是“”。
In the web.config file the reference to the remote service is:
在 web.config 文件中,对远程服务的引用是:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="SVCMappingSoap" 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="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
<message clientCredentialType="UserName" algorithmSuite="Default"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://svc.website.com/services/myService.asmx" binding="basicHttpBinding" bindingConfiguration="SVCMappingSoap" contract="SVCMappingService.SVCMappingSoap" name="SVCMappingSoap"/>
</client>
</system.serviceModel>
I have tried changing a number of the setting in the <security>
section but still unable to replicate.
我已尝试更改该部分中的一些设置,<security>
但仍然无法复制。
回答by himanshu
I am not sure of your total server setup.
我不确定您的总服务器设置。
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
</security>
instead of above one please try with below configuration
而不是上面的一个,请尝试使用以下配置
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm"/>
<message clientCredentialType="UserName" algorithmSuite="Default"/>
</security>
please go through below links, you can more idea on those and you can change the config based on your requirements:
请通过以下链接,您可以对这些链接有更多了解,并且可以根据您的要求更改配置:
回答by Jeroen K
I had to change the default generated
我不得不更改默认生成的
<security mode="Transport"/>
into
进入
<security mode="Transport" >
<transport clientCredentialType="Ntlm"/>
</security>
回答by Weifeng
One more comment for this problem:
这个问题的另一条评论:
If you are not using HTTPS,
如果您没有使用 HTTPS,
<security mode="Transport"/>
is not supported. You can use
不支持。您可以使用
<security mode="TransportCredentialOnly">
instead.
反而。