WCF NetMessagingBinding和传出配额
我正在尝试使用WCF和NetMessagingBinding将消息发布到Windows服务总线主题中,对于大消息(至少603kb),推送操作会引发以下错误:WCF NetMessagingBinding和传出配额,wcf,wcf-binding,servicebus,Wcf,Wcf Binding,Servicebus,我正在尝试使用WCF和NetMessagingBinding将消息发布到Windows服务总线主题中,对于大消息(至少603kb),推送操作会引发以下错误: System.ServiceModel.QuotaExceededException: The maximum message size quota for outgoing messages (262144) has been exceeded. Server stack trace: at System.Runtime.Buf
System.ServiceModel.QuotaExceededException: The maximum message size quota for outgoing messages (262144) has been exceeded.
Server stack trace:
at System.Runtime.BufferedOutputStream.WriteCore(Byte[] buffer, Int32 offset, Int32 size)
at System.Xml.XmlBinaryNodeWriter.FlushBuffer()
at System.Xml.XmlStreamNodeWriter.GetBuffer(Int32 count, Int32& offset)
at System.Xml.XmlStreamNodeWriter.UnsafeWriteUTF8Chars(Char* chars, Int32 charCount)
at System.Xml.XmlBinaryNodeWriter.UnsafeWriteText(Char* chars, Int32 charCount)
at System.Xml.XmlBinaryNodeWriter.WriteText(String value)
at System.Xml.XmlBaseWriter.WriteString(String value)
(...)
从错误中我注意到问题不是序列化,因此我不能使用消息格式化程序。我还可以使用什么来克服此异常?有什么想法吗
提前谢谢 通过将netMessagingBinding替换为使用netMessagingTransport的customBinding,解决了此问题 1-将netMessagingTransport添加为绑定扩展:
<bindingElementExtensions>
<add name="netMessagingTransport" type="Microsoft.ServiceBus.Messaging.Configuration.NetMessagingTransportExtensionElement, Microsoft.ServiceBus, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</bindingElementExtensions>
2-添加自定义绑定:
<customBinding>
<binding name="sbBindingConfiguration" sendTimeout="00:01:00" receiveTimeout="00:01:00" openTimeout="00:01:00">
<binaryMessageEncoding>
<readerQuotas maxDepth="100000000" maxStringContentLength="100000000"
maxArrayLength="100000000" maxBytesPerRead="100000000" maxNameTableCharCount="100000000"/>
</binaryMessageEncoding>
<netMessagingTransport manualAddressing="false" maxBufferPoolSize="100000" maxReceivedMessageSize="100000000">
<transportSettings batchFlushInterval="00:00:00"/>
</netMessagingTransport>
</binding>
</customBinding>
3-使用属性maxReceivedMessageSize定义一个适合将要交换的消息大小的值
4-在端点中引用自定义绑定
<endpoint (...) binding="customBinding" bindingConfiguration="sbBindingConfiguration" />