修改服务器端配置文件
<system.serviceModel>
<!--添加服务-->
<services>
<!--name 必须与代码中的host实例初始化的服务一样 behaviorConfiguration 行为配置 -->
<service name="DRP_BaseData.ServiceBaseData" behaviorConfiguration="BaseDataServerBehavior">
......
<!--添加契约接口 contract="WcfDemo.IService1" WcfDemo.IService1为契约接口 binding="wsHttpBinding" wsHttpBinding为通过Http调用-->
<endpoint binding="wsHttpBinding" contract="DRP_BaseData.IServiceBaseData" bindingConfiguration="ServerBinding" >
</endpoint>
</service>
<behaviors>
......
<behaviors>
<bindings>
<wsHttpBinding>
......
<binding name="ServerBinding">
<security mode="None"/>
</binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>
修改服务器端配置文件
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
......
</configSections>
<applicationSettings>
......
</applicationSettings>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IServiceTransactionData" closeTimeout="00:03:00"
openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:05:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="6242880" maxReceivedMessageSize="6553600"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="None" /> <!--主要是将此改改为 None-->
</binding>
</wsHttpBinding>
</bindings>
<client>
......
</client>
</system.serviceModel>
</configuration>