繁体   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