Gra*_*ark 4 wcf iis-7 was nettcpbinding
我有一个WCF服务操作,它接受一个字节数组作为其数据协定的一部分.该服务仅在内部公开(而不是互联网),我想增加配额以允许10MB字节数组.
该服务托管在IIS7中.当我尝试发送超过默认长度的字节数组时,我收到以下异常消息:
反序列化MyService.ServiceContracts.Data类型的对象时出错.读取XML数据时已超出最大数组长度配额(16384).通过更改创建XML阅读器时使用的XmlDictionaryReaderQuotas对象上的MaxArrayLength属性,可以增加此配额.第1行,第22991位.
这是配置:
<system.serviceModel>
<netTcpBinding>
<binding name="largeBinaryBinding" maxReceivedMessageSize="10001000"
maxBufferPoolSize="80008000" maxBufferSize="10001000"
receiveTimeout="00:01:00" openTimeout="00:01:00"
closeTimeout="00:01:00" sendTimeout="00:01:00">
<readerQuotas maxArrayLength="10000000" />
</binding>
</netTcpBinding>
<services>
<service name="MyService">
<endpoint binding="netTcpBinding"
bindingConfiguration="largeBinaryBinding"
bindingNamespace="http://my.services.co.uk/MyService"
contract="Services.MyService.ServiceContracts.IMyService" />
</service>
</services>
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud)
所以我的配置允许更大的消息,但IIS似乎忽略了这一点 - 如何阻止这种情况并允许大量消息通过?
再次,在我发布问题后,我发现了答案!
使用WAS时,需要在配置的服务名称中指定服务的完整类名.所以在我的例子中,我MyService在命名空间中调用了我的服务实现类Services.因此,在配置中,我需要
<service name="Services.MyService">
...
Run Code Online (Sandbox Code Playgroud)
否则IIS会默默地忽略您精心设计的配置!多方便
| 归档时间: |
|
| 查看次数: |
1162 次 |
| 最近记录: |