【问题标题】:The caller was not authenticated by the service (wsDualHttpBinding)调用者未通过服务的身份验证 (wsDualHttpBinding)
【发布时间】:2014-02-26 10:39:17
【问题描述】:

我不需要任何类型的身份验证,客户端和服务不会在同一台机器上和不同的域中。当我尝试连接到该服务时,我收到以下错误。

'System.ServiceModel.Security.SecurityNegotiationException' 附加 信息:调用者未通过服务的身份验证。

因此我尝试关闭服务安全性:

  <system.serviceModel>
    <bindings>
      <wsDualHttpBinding>
        <binding name="CustomDualBinding">
          <security>
            <message clientCredentialType="None" negotiateServiceCredential="false" />
          </security>
        </binding>
      </wsDualHttpBinding>
    </bindings>
    <services>
      <service name="WCFServiceWebRoleStockTrading.Service">
        <endpoint address="Service.svc" binding="wsDualHttpBinding" bindingConfiguration="CustomDualBinding"
          contract="WCFServiceWebRoleStockTrading.IService" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>

现在,当我尝试自行运行服务时,我收到以下错误消息:

未提供服务证书。指定服务证书 在 ServiceCredentials 中。

但我不需要任何安全措施。安装服务证书意味着我希望我的客户安装相同的证书以进行身份​​验证,对吗?不过这不是我想要的。

我很坚持这一点,非常感谢您的建议。

【问题讨论】:

    标签: .net wcf authentication


    【解决方案1】:

    我好像找到了。我发现很难使用 Visual Studio 中的 WCF Config 编辑器来正确处理它。最好是复制粘贴。

     <system.serviceModel>
        <bindings>
          <wsDualHttpBinding>
            <binding name="CustomDualBinding">
              <security mode="None" />
            </binding>
          </wsDualHttpBinding>
        </bindings>
        <services>
          <service name="WCFServiceWebRoleStockTrading.Service">
            <endpoint address="" binding="wsDualHttpBinding" bindingConfiguration="CustomDualBinding"
              contract="WCFServiceWebRoleStockTrading.IService" />
          </service>
        </services>
    ...
     </system.serviceModel>
    

    在客户端确保在你的配置中有这个:

    Uri baseAddress = new Uri("http://xxx.cloudapp.net/Service.svc");
    WSDualHttpBinding wsd = new WSDualHttpBinding();
    wsd.Security = new WSDualHttpSecurity() { Mode = WSDualHttpSecurityMode.None, Message = new MessageSecurityOverHttp() { ClientCredentialType = MessageCredentialType.None, NegotiateServiceCredential = false } };
    EndpointAddress ea = new EndpointAddress(baseAddress);            
    
    InstanceContext site = new InstanceContext(this);
    _client = new ServiceClient(site, wsd, ea);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-08-21
      • 2018-03-28
      • 1970-01-01
      • 1970-01-01
      • 2010-09-22
      • 1970-01-01
      • 2013-09-10
      相关资源
      最近更新 更多