【发布时间】:2012-03-08 08:54:00
【问题描述】:
我已经寻找了很多解决方案来解决我的问题,但我没有找到任何对我有好处的方法。
我的问题很简单:我无法通过网络服务发送长字节数组。我可以发送一个代表 4 KB 图像的数组,但不会更大。
这是客户端配置
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_ICespitiAVService" closeTimeout="02:00:00"
openTimeout="02:00:00" receiveTimeout="02:00:00" sendTimeout="02:00:00" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" >
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:51366/CespitiAVService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICespitiAVService"
contract="CespitiAVService.ICespitiAVService" name="BasicHttpBinding_ICespitiAVService"/>
</client>
</system.serviceModel>
</configuration>
这是服务器配置
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<client />
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
<dataContractSerializer maxItemsInObjectGraph="655360"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true"/>
</system.serviceModel>
我读过一些解决方案,有人说要将 readerquotas 也放在客户端配置中,但 xml 不接受它,说它只接受安全节点。
有人说在客户端配置中更改传输模式可以解决问题,但我只能使用缓冲模式,它不接受任何其他内容。
我使用了 fiddler,它说程序超出了 maxarraylength,如您所见,我在 web.config 中更改了此值,但我无法在客户端配置中更改,因为它说绑定节点没有 readerquotas 属性。
【问题讨论】:
标签: .net arrays web-services configuration