错误:WCF读取XML数据时超出最大字符串内容长度配额(8192)

tmjeming 2010-11-17 04:39:56
读取 XML 数据时,超出最大字符串内容长度配额 (8192)。通过更改在创建 XML 读取器时所使用的 XmlDictionaryReaderQuotas 对象的 MaxStringContentLength 属性,可增加此配额。
服务器端配置

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="WorkManageWcfService.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<system.net>
<settings>
<servicePointManager expect100Continue="false" />
</settings>
</system.net>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</compilation>
<customErrors mode="Off" />
</system.web>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
<behaviors>
<serviceBehaviors>
<behavior name="MyBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceCredentials/>
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="MyBehavior" name="WorkManageWcfService.WorkManageService">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="NewBinding2MB" contract="WorkManageWcfService.IWorkManageService"></endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service behaviorConfiguration="MyBehavior" name="WorkManageWcfService.LoginService">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="NewBinding2MB" contract="WorkManageWcfService.ILoginService"></endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service behaviorConfiguration="MyBehavior" name="WorkManageWcfService.SystemManagementService">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="NewBinding2MB" contract="WorkManageWcfService.ISystemManagementService"></endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="NewBinding2MB" maxReceivedMessageSize="20971510">
<readerQuotas maxStringContentLength="20971520" maxArrayLength="20971520" />
<security mode="None"></security>
</binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
<applicationSettings>
<WorkManageWcfService.Properties.Settings>
<setting name="WorkManageWcfService_GetIPAddress_IpAddressSearchWebService"
serializeAs="String">
<value>http://www.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx</value>
</setting>
</WorkManageWcfService.Properties.Settings>
</applicationSettings>
</configuration>


客服端配置
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="StoreManage.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</sectionGroup>
</configSections>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="wshttpbindings" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="20971510"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="20971520"
maxArrayLength="20971520" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://www.joyparty.net/ToonyooWebservice/ShopService/ShopData/ShopDataService.svc"
binding="wsHttpBinding" bindingConfiguration="wshttpbindings"
contract="ShopData.ICommonality" name="BasicHttpBinding_ICommonality" />
<endpoint address="http://www.joyparty.net/ToonyooWebservice/ShopService/ShopData/ShopDataService.svc"
binding="wsHttpBinding" bindingConfiguration="wshttpbindings"
contract="ShopData.IMemberRobert" name="BasicHttpBinding_IMemberRobert" />
<endpoint address="http://www.joyparty.net/ToonyooWebservice/ShopService/ShopData/ShopDataService.svc"
binding="wsHttpBinding" bindingConfiguration="wshttpbindings"
contract="ShopData.IUserLogin" name="BasicHttpBinding_IUserLogin" />
<endpoint address="http://www.joyparty.net/ToonyooWebservice/ShopService/ShopData/ShopDataService.svc"
binding="wsHttpBinding" bindingConfiguration="wshttpbindings"
contract="ShopData.IStoreManageData" name="BasicHttpBinding_IStoreManageData" />
<endpoint address="http://www.joyparty.net/ToonyooWebservice/ShopService/ShopData/ShopDataService.svc"
binding="wsHttpBinding" bindingConfiguration="wshttpbindings"
contract="ShopData.IValidIdentity" name="BasicHttpBinding_IValidIdentity" />
<endpoint address="http://www.joypartychina.com.cn/WorkManage/WorkManageService.svc"
binding="wsHttpBinding" bindingConfiguration="wshttpbindings"
contract="WorkService.IWorkManageService" name="WSHttpBinding_IWorkManageService" />
<endpoint address="http://www.joypartychina.com.cn/WorkManage/WorkManageService.svc"
binding="wsHttpBinding" bindingConfiguration="wshttpbindings"
contract="CenterWorkManageService.IWorkManageService" name="WSHttpBinding_IWorkManageServiceCenter" />
<endpoint address="http://www.joyparty.net/ToonyooWebservice/ShopQuery/MemberConsumerNode.svc"
binding="wsHttpBinding" bindingConfiguration="wshttpbindings"
contract="ShopQuery.IMemberConsumerNode" name="BasicHttpBinding_IMemberConsumerNode" />
<endpoint address="http://www.joypartychina.com.cn/WorkManage/SystemManagementService.svc"
binding="wsHttpBinding" bindingConfiguration="wshttpbindings"
contract="SystemService.ISystemManagementService" name="WSHttpBinding_ISystemManagementService" />
<endpoint address="http://localhost:10628/BusinessCashService.svc"
binding="wsHttpBinding" bindingConfiguration="wshttpbindings"
contract="RevenueService.IBusinessCashService" name="WSHttpBinding_IBusinessCashService" />
</client>
</system.serviceModel>
<connectionStrings>
<add name="SystemManagementAddress" connectionString="http://www.joypartychina.com.cn/WorkManage/SystemManagementService.svc" />
<add name="WCFAddress" connectionString="http://www.joypartychina.com.cn/QueryService/WMSQueryService.svc" />
<add name="LoginAddress" connectionString="http://www.joypartychina.com.cn/WorkManage/LoginService.svc" />
<add name="CenterAddress" connectionString="http://www.joypartychina.com.cn/QueryService/WMSQueryService.svc"/>
</connectionStrings>
</configuration>

...全文
1900 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
张云飞VIR 2011-07-07
  • 打赏
  • 举报
回复
我们在传输大文件或者大数据时使用。尝试在服务器修改在binding ,然后更新客户机的服务引用.xml描述如下:

<bindings>
<basicHttpBinding>
<binding name="DocumentExplorerServiceBinding" sendTimeout="00:10:00" transferMode="Streamed" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="9223372036854775807">
<readerQuotas maxArrayLength="2147483647"></readerQuotas>
</binding>
</basicHttpBinding>
</bindings>

renyu_net 2011-07-07
  • 打赏
  • 举报
回复
楼主问题解决了吗 我现在也出现此问题, 修改了配置文件没有作用,实在不知该修改哪个配置了
tmjeming 2010-11-18
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 chenkui2008 的回复:]
额,额,额,我知道了!
[/Quote]

o(︶︿︶)o 唉 你知道啥了。
chenkui2008 2010-11-17
  • 打赏
  • 举报
回复
额,额,额,我知道了!

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧