我的 web.config 的 serviceModel 部分:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="default" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
textEncoding="utf-8" useDefaultWebProxy="true"
messageEncoding="Text">
<readerQuotas maxDepth="32" maxStringContentLength="8192"
maxArrayLength="2147483647"
maxBytesPerRead="4096" maxNameTableCharCount="2147483647" />
</binding>
</wsHttpBinding>
</bindings>
<services>
<service name="templateMgr">
<endpoint address="http://edocengine.localtest.me/services/templateMgr.svc"
name="templateMgr.svc" binding="wsHttpBinding" contract="ItemplateMgr"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"
aspNetCompatibilityEnabled="true"/>
</system.serviceModel>
请注意,我在wsHttpBinding
这里指定了一个大的MaxReceivedMessageSize
. 然而,当我在代码中设置断点时
? System.ServiceModel.OperationContext.Current.Host.Description.Endpoints(0).Binding.Name
"BasicHttpBinding"
? ctype(System.ServiceModel.OperationContext.Current.Host.Description.Endpoints(0).Binding,System.ServiceModel.BasicHttpBinding).MaxReceivedMessageSize
65536
是什么赋予了?
编辑:这显然是服务器 web.config。我的客户端使用老式 SOAP Web 服务(wsdl.exe 代理)而不是 WCF 服务引用(svcutil.exe)来引用该服务。因此客户端在其 app.config 中没有 serviceModel 部分。以下是客户端拨打电话时发送的标头:
POST http://edocengine.localtest.me/services/templateMgr.svc HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 4.0.30319.18052)
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://www.edocbuilder.com/ItemplateMgr/setAssets"
Host: edocengine.localtest.me
Content-Length: 12192
Expect: 100-continue
编辑:找到答案,修改标题。