我构建了一个使用 wsHttpBinding 的 WCF 服务和一个调用它的客户端。
但我仍然收到以下错误消息:
An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail.
内部例外是:
An error occurred when processing the security tokens in the message.
这是服务的配置文件:
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="myWsBinding">
<security>
<message negotiateServiceCredential="false" algorithmSuite="Basic128"
establishSecurityContext="false" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="ServiceBehavior" name="HelloWorldService.HelloService">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="myWsBinding"
contract="HelloWorldService.IHelloService">
<identity>
<servicePrincipalName value="host/MAGBAREYA"/>
</identity>
</endpoint>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8999/myService" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
这是客户端配置文件:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IHelloService">
<security mode="Message">
<message clientCredentialType="Windows" negotiateServiceCredential="false"
algorithmSuite="Basic128" establishSecurityContext="false" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8999/myService" binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IHelloService" contract="ServiceReference1.IHelloService"
name="WSHttpBinding_IHelloService">
<identity>
<servicePrincipalName value="host/MAGBAREYA"/>
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
有问题的配置是:negotiateServiceCredential="false"。
如果我在服务和客户端中都将其设置为 true,则客户端将完美运行。(除了此更改之外,使用上述配置文件)
谁能告诉我在这里想念什么?
提前致谢。