尝试连接到WCF Web服务时出现以下错误:
WCF web query ...
Unhandled Exception: System.ServiceModel.Security.SecurityNegotiationException:
The caller was not authenticated by the service. ---> System.ServiceModel.FaultException: The request for security token could not be satisfied because authentication failed.
at System.ServiceModel.Security.SecurityUtils.ThrowIfNegotiationFault(Message
message, EndpointAddress target)
at System.ServiceModel.Security.SspiNegotiationTokenProvider.GetNextOutgoingM
essageBody(Message incomingMessage, SspiNegotiationTokenProviderState sspiState)
我在C#中编写了WCF客户端和服务器应用程序。客户端在本地运行时很好地与服务器通信,但当我对复制到远程Amazon EC2云计算机的远程服务器进行相同的调用时,会因证书请求错误而崩溃。
如何暂时关闭WCF中的证书请求,以便我能看到一切是否正常工作?
答案 0 :(得分:0)
知道了!切断了安全性。我现在可以与远程WCF服务交谈,它完全可以正常工作。
关键是运行WCF配置工具将传输层更改为basicHTTP绑定,并确保默认情况下关闭安全性。这是步骤。
这是完成的App.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="nosecurity" />
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="PhiFeedServiceBehavior" name="NeuralFutures.Datafeed.PhiFeed">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="nosecurity"
contract="NF.Datafeed.IPhiFeed" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:31415/PhiFeed" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="PhiFeedServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="False"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>