Folks,
感谢您帮助解决我之前的 WCF 配置文件问题。这是一个新的。
我的项目是一个 WinForms 应用程序客户端 (.NET 4.0),它从 IIS 7.0 上托管的 WCF 服务中提取数据(并将其保存到)。当我保存少量有效负载时,一切都很好。当我尝试保存超过 8192 字节的有效负载时,错误是:
格式化程序在尝试反序列化时抛出异常
消息:尝试反序列化参数时出错http://tempuri.org/:objEncounterType http://tempuri.org/:objEncounterType。 InnerException 消息是
'反序列化类型对象时出错
PsychCoverage.Common.EncounterType。最大字符串内容长度
读取 XML 数据时超出配额 (8192)。这个配额可能
通过更改 MaxStringContentLength 属性来增加
创建 XML 读取器时使用的 XmlDictionaryReaderQuotas 对象。
1 号线,位置 10809。'。更多内容请参见InnerException
细节
我已经确认我的<binding name="">
和我的一样<endpoint bindingConfiguration="">
.
我已经设置了我的maxReceivedMessageSize
and maxBufferPoolSize
and maxBufferSize
我的两个客户端都为 10,000,000app.config
and my web.config
。我尝试让我的<readerQuota>
价值非常高。
在我的 web.config 中我设置<httpRuntime maxRequestLength="10000000" />
这是我的客户发来的app.config
:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="wcfAdmin_binding"
maxReceivedMessageSize="10000000"
maxBufferPoolSize="10000000"
maxBufferSize="10000000"
messageEncoding="Text"
sendTimeout="00:05:00"
receiveTimeout="00:05:00"
bypassProxyOnLocal="false"
hostNameComparisonMode="StrongWildcard"
textEncoding="utf-8"
useDefaultWebProxy="true"
allowCookies="false"
>
<readerQuotas maxDepth="200" maxStringContentLength="10000000" maxArrayLength="16384" maxBytesPerRead="10000000" maxNameTableCharCount="16384" />
<security mode="None"></security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<clear/>
<endpoint address="http://localhost/PsychCoverage/Admin.svc" name="AdminUIClientEndpoint" binding="basicHttpBinding" bindingConfiguration="wcfAdmin_binding" contract="PsychCoverage.Common.IAdmin">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>
这是我的服务web.config
:
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="False" ></serviceHostingEnvironment>
<bindings>
<basicHttpBinding>
<binding name="wcfAdmin_binding"
maxReceivedMessageSize="10000000"
maxBufferPoolSize="10000000"
maxBufferSize="10000000"
messageEncoding="Text"
sendTimeout="00:05:00"
receiveTimeout="00:05:00">
<readerQuotas maxDepth="200"
maxStringContentLength="10000000"
maxArrayLength="16384"
maxBytesPerRead="10000000"
maxNameTableCharCount="16384" />
<security mode="None"></security>
</binding>
<binding name="wcfClientWebPortal_binding"
maxReceivedMessageSize="10000000"
maxBufferPoolSize="10000000"
maxBufferSize="10000000"
messageEncoding="Text"
sendTimeout="00:05:00"
receiveTimeout="00:05:00">
<readerQuotas maxDepth="200"
maxStringContentLength="10000000"
maxArrayLength="16384"
maxBytesPerRead="10000000"
maxNameTableCharCount="16384" />
<security mode="None"></security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="wcfBehavior" name="PsychCoverage.WcfMT.Admin">
<endpoint address=""
binding="basicHttpBinding"
bindingConfiguration="wcfAdmin_binding"
name="AdminEndpoint"
bindingName="wcfAdmin_binding"
contract="PsychCoverage.Common.IAdmin">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</service>
<service behaviorConfiguration="wcfBehavior" name="PsychCoverage.WcfMT.ClientWebPortal">
<endpoint address=""
binding="basicHttpBinding"
bindingConfiguration="wcfClientWebPortal_binding"
name="ClientWebPortalEndpoint"
bindingName="wcfClientWebPortal_binding"
contract="PsychCoverage.Common.IClientWebPortal">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="wcfBehavior">
<!-- To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="False" />
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceThrottling maxConcurrentCalls="100" maxConcurrentSessions="100" maxConcurrentInstances="100" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
提前谢谢了。