簡體   English   中英

WCF:無法為具有權限的SSL / TLS安全通道建立信任關系

[英]WCF: Could not establish trust relationship for the SSL/TLS secure channel with authority

我已經設置了我的IIS WCF Web服務以使用Windows身份驗證(通過https),並且在訪問WSDL時,我從服務器獲得了進行身份驗證的請求,然后該請求正常運行。 所以一切都很好。

但是,我無法弄清楚如何傳遞當前用戶的Windows憑據,我不斷收到主題中詳細說明的錯誤。

這是服務器web.config:

  <?xml version="1.0" encoding="UTF-8"?>
  <configuration>
    <system.serviceModel>

      <bindings>
        <wsHttpBinding>
          <binding name="wsBindingTest">
            <security mode="Transport">
              <message negotiateServiceCredential="true" clientCredentialType="Windows"/>
              <transport clientCredentialType="Windows"/>
            </security>
          </binding>
        </wsHttpBinding>
      </bindings>

      <protocolMapping>
        <remove scheme="http" />
        <add scheme="http" binding="wsHttpBinding" bindingConfiguration="wsBindingTest" />
      </protocolMapping>

      <behaviors>
        <serviceBehaviors>
          <behavior name="">
            <serviceMetadata httpGetEnabled="true"  />
            <serviceDebug includeExceptionDetailInFaults="true" />
          </behavior>
        </serviceBehaviors>
      </behaviors>

      <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    </system.serviceModel>
  </configuration>

這是客戶:

  <?xml version="1.0" encoding="utf-8" ?>
  <configuration>
      <system.serviceModel>
          <bindings>
              <wsHttpBinding>
                  <binding name="BasicHttpBinding_ITRIMService">
                    <security mode="Transport">
                      <transport clientCredentialType="Windows" proxyCredentialType="None" />
                      <message clientCredentialType="Windows" negotiateServiceCredential="true"/>
                    </security>
                  </binding>
              </wsHttpBinding>
          </bindings>
          <client>
              <endpoint address="https://servername.net/TRIMDev/TRIMService.svc"
                  binding="wsHttpBinding" bindingConfiguration="BasicHttpBinding_ITRIMService"
                  contract="Service.ITRIMService" name="BasicHttpBinding_ITRIMService">
                  <identity>
                      <servicePrincipalName value="host/servername.net" />
                  </identity>
              </endpoint>
          </client>
      </system.serviceModel>
  </configuration>

這是最終創建頻道的代碼:

ConfigurationChannelFactory<ITRIMService> channelFactory = new ConfigurationChannelFactory<ITRIMService>("BasicHttpBinding_ITRIMService", config, null);
var channel = channelFactory.CreateChannel();

我嘗試將以下內容添加到客戶端配置中,沒有運氣,希望無需在客戶端中編寫任何代碼即可完成:

    <system.web>
      <identity impersonate="true"/>
      <authentication mode="Windows" />
    </system.web>

任何幫助都會非常感激,因為我只是不知道為什么它不起作用。

Windows身份驗證不適用於wsHttpBinding ,它僅支持NetTcpBinding 參考信息在這里

暫無
暫無

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

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