簡體   English   中英

Wcf服務異常“使用客戶端身份驗證方案未授權HTTP請求”

[英]Wcf service exception “The HTTP request is unauthorized with client authentication scheme”

在從外部供應商wcf服務進行處理時,客戶端出現異常,例如"The HTTP request is unauthorized with client authentication scheme 'Basic'. The authentication header received from the server was 'Basic realm="CASM"'". 我在某個時間點從Web服務請求大數據,我正在獲取異常。有趣的是,我正在從WCF服務獲取一些數據,並且在獲取異常之后。所以我假設是否需要微調請求? 所以我不應該一次詢問大數據,否則這是一個不同的問題。 我確實喜歡顯示“ 在VS2012中添加Web服務引用時出錯 ”的帖子,但是沒有運氣。 有人可以告訴我此異常背后的所有可能原因是什么。 以下是我的webconfig部分,我在代碼中使用用戶名和密碼

<binding name="Test" closeTimeout="00:01:00" openTimeout="00:01:00"
      receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
      bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
      maxBufferSize="6553600" maxBufferPoolSize="524288" maxReceivedMessageSize="6553600"
      messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
      useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Basic" proxyCredentialType="Basic"
          realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>
    </binding>
  <endpoint address="http://testurl/as" binding="basicHttpBinding"
    bindingConfiguration="Test" contract="Testservice.Test" name="Test">
  </endpoint>

UPDATE

還有一件事是這個realm="CASM"是什么例外,我無法在客戶端配置中設置,intellisense沒有給出

嘗試改變這個

 <security mode="TransportCredentialOnly">
    <transport clientCredentialType="Basic" proxyCredentialType="Basic"
      realm="" />
    <message clientCredentialType="UserName" algorithmSuite="Default" />
  </security>

用這條線

<security mode="TransportCredentialOnly">
   <transport clientCredentialType="Anonymous"/>
   <message clientCredentialType="UserName" algorithmSuite="Default"/>
</security>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM