繁体   English   中英

调用者未通过服务验证(wsDualHttpBinding)

[英]The caller was not authenticated by the service (wsDualHttpBinding)

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

'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中指定服务证书。

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

我对此非常执着,非常感谢您的建议。

我似乎已经找到了。 我发现很难,要在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);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM