gpt4 book ai didi

asp.net - 使用 wcf 服务传输大量数据

转载 作者:行者123 更新时间:2023-12-02 00:14:48 24 4
gpt4 key购买 nike

当我尝试在 WCF 中传输大量数据时,出现此错误:

The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:requete. The InnerException message was 'There was an error deserializing the object of type System.String. The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 1, position 8843.'. Please see InnerException for more details.

这是我的 app.config 文件:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="NewBinding0" maxBufferSize="52428800" maxBufferPoolSize="52428800">
<readerQuotas maxStringContentLength="52428800" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="TSO_WCF.Service1">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Design_Time_Addresses/TSO_WCF/Service1/" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address="" binding="wsHttpBinding" contract="TSO_WCF.IService1" >
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<appSettings>
<add key="Mapping" value="D:\workspace\oddo.app.ldw.tsomanagertool\ProjetTSO\MappingsXML"/>
</appSettings>
</configuration>

最佳答案

您应该增加服务器和客户端绑定(bind)上的 MaxStringContentLength。此时您使用的是默认值 8192。

关于asp.net - 使用 wcf 服务传输大量数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13707255/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com