string的length方法(数组length方法)

C#客户端,调用别家的webservice,返回信息报错,摘取其中重要的如下:Themaximumstringcontentlengthquota(8192)hasbeenexceededwhilereadingXMLdata.ThisquotamaybeincreasedbychangingtheMaxStringContentLengthpro…

大家好,又见面了,我是你们的朋友全栈君。

C#客户端,调用别家的webservice,返回信息报错,摘取其中重要的如下:

The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property

不过这个问仅仅出现在Win XP系统,同样的调用在WIn 7和Win 10上没有出现。

这个问题曾经解决过,是通过修改配置文件,增加<readerQuotas>节点解决的。不过这次用“同样的方法”却问题依旧。

 经过一番探索,找到了办法,其实还是增加<readerQuotas>节点,但需要加在正确的<binding>节点中。正确的配置文件如下:

<basicHttpBinding>
    <binding name="sDataInfraceSoap" />
    <binding name="instrumentDockingServiceProviderServiceBinding">
			<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
				maxArrayLength="2147483647" maxBytesPerRead="2147483647"
				maxNameTableCharCount="2147483647" />
     </binding>
     <binding name="sDataInfraceSoap1" />
      <binding name="sDataInfraceSoap2" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" >
			<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
				maxArrayLength="2147483647" maxBytesPerRead="2147483647"
				maxNameTableCharCount="2147483647" />
	</binding>
    <binding name="StandardInterfaceSoap11Binding" />
</basicHttpBinding>

本项目比较特殊,一个软件集成了多个别家的webservice,所有配置文件里面的binding节点很多,这里就有四种:

sDataInfraceSoap

instrumentDockingServiceProviderServiceBinding

sDataInfraceSoap1

sDataInfraceSoap2

在<client>节点中确认一下报错的调用匹配的是哪一个binding:

<client>
      <endpoint address="http://aaa" binding="basicHttpBinding" bindingConfiguration="sDataInfraceSoap" contract="ServiceEtMobile.sDataInfraceSoap" name="sDataInfraceSoap" />
      <endpoint address="http://bbb" binding="basicHttpBinding" bindingConfiguration="sDataInfraceSoap1" contract="ServiceEtMobile2018.sDataInfraceSoap" name="sDataInfraceSoap1" />
      <endpoint address="http://xxx" binding="basicHttpBinding" bindingConfiguration="instrumentDockingServiceProviderServiceBinding" contract="ServiceZYD.instrumentDockingServiceProvider" name="instrumentDockingServiceProviderService" />
      <endpoint address="http://kkk" binding="basicHttpBinding" bindingConfiguration="sDataInfraceSoap2" contract="ServiceEtMobile2.sDataInfraceSoap" name="sDataInfraceSoap2" />
      <endpoint address="http://iii" binding="basicHttpBinding" bindingConfiguration="StandardInterfaceSoap11Binding" contract="ServiceJSSYJ_STD_Test.StandardInterfacePortType" name="StandardInterfaceHttpSoap11Endpoint" />
      <endpoint address="http://ttt" binding="customBinding" bindingConfiguration="StandardInterfaceSoap12Binding" contract="ServiceJSSYJ_STD_Test.StandardInterfacePortType" name="StandardInterfaceHttpSoap12Endpoint" />
</client>

也就是说,<readerQuotas>节点要加在对应的binging节点中才有效。当然,笨办法就是几个binding节点都加上。

问题解决。

 

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/127559.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号