[英]The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'NTLM’
我有一個用VB.NET編寫的ASP.NET Web應用程序。 應用程序的一部分對內部ASMX文件進行AJAX調用,后者又調用遠程Web服務,該服務只是一個ASMX文件。 通常這工作正常,並已部署了幾次,工作正常。 但是,一個客戶端從AJAX調用獲取消息:
HTTP請求未經授權,客戶端身份驗證方案為“匿名”。 從服務器收到的身份驗證標頭是“NTLM”。
我已經搜索了大量試圖解決此問題的網站,但我似乎無法找到適合我的任何答案。
我無法在我的測試服務器上復制錯誤,這與客戶端Win2003 IIS6相同。
遠程Web服務部署在Windows 2008 r2 - IIS7.5上。 僅使用“匿名”身份驗證部署遠程服務。 客戶端部署使用Anonymous和“集成Windows身份驗證”進行設置。 我嘗試在兩個實現上更改身份驗證級別,但無法復制該問題。 我最接近的是當我將遠程服務IIS身份驗證設置為
HTTP請求未經授權使用客戶端身份驗證方案'Ntlm'。 從服務器收到的身份驗證標頭是''。
在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>
我嘗試更改<security>
部分中的一些設置但仍無法復制。
我不確定您的服務器總設置。
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
</security>
請使用以下配置嘗試而不是上面一個
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm"/>
<message clientCredentialType="UserName" algorithmSuite="Default"/>
</security>
請通過以下鏈接,您可以更多地了解這些,您可以根據您的要求更改配置:
我不得不改變生成的默認值
<security mode="Transport"/>
成
<security mode="Transport" >
<transport clientCredentialType="Ntlm"/>
</security>
還有一個關於這個問題的評論:
如果您不使用HTTPS,
<security mode="Transport"/>
不受支持。 您可以使用
<security mode="TransportCredentialOnly">
代替。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.