异常排除: 调用方未由服务进行身份验证
为客户端和服务器端各增加节点bindings
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="NoneSecurity"
maxBufferPoolSize="12000000" maxReceivedMessageSize="12000000"
useDefaultWebProxy="false">
<readerQuotas maxStringContentLength="12000000"
maxArrayLength="12000000"/>
<security mode="None"/>
</binding>
</wsHttpBinding>
</bindings>
<!--看到client,就表明是客户端设置-->
<client>
<!--定义访问时的终节点,name也是随意取的,注意address是Server端发布时指定的baseAddress+endpoint的
address,binding也要对应,contract就更不用说了,由于之前把IData.cs拷过来的时候没有修改命名空间,所以还是
Server.IData-->
<endpoint name="Worker" address="http://192.168.1.155/news.svc"
binding="wsHttpBinding" bindingConfiguration="NoneSecurity"
contract="INews.INews"/>
</client>
</system.serviceModel>
并且为endpoint节点配置需要身份验证为否