在正确设置好net.tcp WCF服务并发布到IIS后,客户端还是不能引用服务出现类似如下错误:

 

net.tcp WCF引用出错 “超出最大名称表字符计数配额(16384)”

该问题并不一定设置MaxNameTableCharCount能解决,即便设置一个很大的数字还是不能正确引用,其实这个问题是由于VS的环境引起,需要修改一下配置文件:

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>  

  </system.serviceModel> 

重启VS,后再次引用成功! 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-14
  • 2022-12-23
  • 2021-10-28
  • 2022-12-23
  • 2022-02-20
猜你喜欢
  • 2021-07-23
  • 2021-11-25
  • 2022-12-23
  • 2022-01-23
相关资源
相似解决方案