<system.serviceModel>
<services>
<!--基础数据服务-->
<service name="PmsWcfServer.PmsWcfBaseData" behaviorConfiguration="WcfBaseData">
<host>
<baseAddresses>
<add baseAddress="net.tcp://127.0.0.1:8081"/>
</baseAddresses>
</host>
<endpoint address="" binding="netTcpBinding" contract="PmsWcfServer.IPmsWcfBaseData" bindingConfiguration="BindBaseData"/>
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WcfBaseData">
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceMetadata httpGetEnabled="false"/>
<serviceCredentials>
<serviceCertificate x509FindType="FindBySubjectName" findValue="PmsWcfServer" storeLocation="LocalMachine"/>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="PmsWcfServer.CheckUserNamePass,PmsWcfServer"/>
</serviceCredentials>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="BindBaseData">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<netTcpBinding>
<binding name="BindBaseData" maxReceivedMessageSize="2147483647">
<security mode="Message">
<message clientCredentialType="UserName"/>
</security>
<!--注意:红色字体,这里必须要修改
maxNameTableCharCount值,增大配额
-->
<readerQuotas maxNameTableCharCount="2147483647" maxStringContentLength="2147483647" maxBytesPerRead="2147483647" maxArrayLength="2147483647" maxDepth="32000"/>
</binding>
</netTcpBinding>
</bindings>
</system.serviceModel>
只是修改以上配置文件,客户端依然后引用不成功,还需要修改:C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.Config文件,在文件后面增加以下节:
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="
BindSystem
"
maxBufferPoolSize="2147483647"
maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint binding="netTcpBinding" bindingConfiguration="
BindSystem
"
contract="IMetadataExchange" name="net.tcp" />
</client>