我在 IIS 托管的 WCF 服务上使用 NetMessagingBinding 来使用在 Windows Server 服务总线主题上发布的消息。
据我了解,Windows Server Service Bus 的主题上的消息大小没有限制,但是我在反序列化订阅中的消息时遇到错误:
System.ServiceModel.Dispatcher.NetDispatcherFaultException: (...)
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.'.
Please see InnerException for more details. ---> System.Runtime.Serialization.SerializationException: There was an error deserializing the object of type [Type].
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. ---> System.Xml.XmlException:
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.
我看到它的方式没有配置可以在 WCF 的 web.config 中更改以更改最大字符串内容。唯一可能相关的属性是 MaxBufferPoolSize,但它不会通过 web.config 公开。
使用的绑定配置是:
<bindings>
<netMessagingBinding>
<binding name="messagingBinding"
closeTimeout="00:03:00" openTimeout="00:03:00"
receiveTimeout="00:03:00" sendTimeout="00:03:00"
prefetchCount="-1" sessionIdleTimeout="00:01:00">
<transportSettings batchFlushInterval="00:00:01" />
</binding>
</netMessagingBinding>
</bindings>
提前致谢,
若昂·卡洛斯·德索萨