纸上得来终觉浅,绝知此事要躬行。

 

部署WCF遇到的问题及解决方案

WCF:调用方未由服务器进行身份验证

服务端添加以下节点:设置安全验证为None;

<bindings>
<wsHttpBinding>
<binding name="NoneSecurity">
<security mode="None"></security>
</binding>
</wsHttpBinding>
</bindings>

同时设置Service节点下的endpoint节点的bindingConfiguration="NoneSecurity";

然后将客户端config文件中的security节配置改为<security mode="None"/>

服务端完整配置文件如下:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<services>
<service name="MyContract.MyService" behaviorConfiguration="MyContract.IMyService">
<host>
<baseAddresses>
<add baseAddress="http://10.8.3.61:8080/MyService/"/>
</baseAddresses>
</host>
<endpoint address="" binding="wsHttpBinding" contract="MyContract.IMyService" bindingConfiguration="NoneSecurity"/>
<!--<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>-->
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyContract.IMyService">
<serviceMetadata httpGetEnabled="true" httpGetUrl=""/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<wsHttpBinding>
<binding name="NoneSecurity">
<security mode="None"></security>
</binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>
</configuration>

posted on 2011-02-16 19:37  JRoger  阅读(358)  评论(0)    收藏  举报

导航