增加 wcf-wpf 服务中的消息大小?
我有一个 wpf 应用程序,想要使用 NetTcpBinding
将 byte[]
发送到我的 wcf(加上 wpf),但
QuotaExceededException: The maximum message size quota for the remote channel has been exceeded. For more information, see the server logs
我在文档中看到了“MaxBufferSize”和“maxReceivedMessageSize”,但这没有帮助。
service app.config
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_IService"
maxBufferSize="20971520"
maxBufferPoolSize="20971520"
maxReceivedMessageSize="20971520"
>
<readerQuotas maxDepth="32"
maxArrayLength="20971520"/>
</binding>
</netTcpBinding>
</bindings>
和我的客户端,从服务引用自动生成的完整配置,除了绑定属性之外,
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_IService"
maxBufferSize="20971520"
maxBufferPoolSize="20971520"
maxReceivedMessageSize="20971520"
>
<readerQuotas maxDepth="32"
maxArrayLength="20971520"/>
<security>
<transport sslProtocols="None" />
</security>
</binding>
</netTcpBinding>
</bindings>
我也尝试获取日志(在客户端),
<system.diagnostics>
<sources>
<source name="System.ServiceModel.MessageLogging" switchValue="Warning,ActivityTracing">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add name="ServiceModelMessageLoggingListener">
<filter type="" />
</add>
</listeners>
</source>
<source propagateActivity="true" name="System.ServiceModel" switchValue="Warning,ActivityTracing">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add name="ServiceModelTraceListener">
<filter type="" />
</add>
</listeners>
</source>
</sources>
<sharedListeners>
<add initializeData="L:\Projects\Service\Client\Client\App_messages.svclog"
type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp">
<filter type="" />
</add>
<add initializeData="L:\Projects\Service\Client\Client\App_tracelog.svclog"
type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
<filter type="" />
</add>
</sharedListeners>
<trace autoflush="true" />
</system.diagnostics>
但它不起作用!它甚至不生成 .svclog 文件。我在这里看到了很多关于这个问题的主题,但我找不到任何可以帮助我的东西。唯一的希望就是当地的主宰
i have a wpf app and want to send byte[]
to my wcf(plus wpf) using NetTcpBinding
but have
QuotaExceededException: The maximum message size quota for the remote channel has been exceeded. For more information, see the server logs
I saw "MaxBufferSize" and "maxReceivedMessageSize" in the document, but it doesn't help.
service app.config
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_IService"
maxBufferSize="20971520"
maxBufferPoolSize="20971520"
maxReceivedMessageSize="20971520"
>
<readerQuotas maxDepth="32"
maxArrayLength="20971520"/>
</binding>
</netTcpBinding>
</bindings>
and my client, the full configuration generated automatically from service ref, except binding attribute
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_IService"
maxBufferSize="20971520"
maxBufferPoolSize="20971520"
maxReceivedMessageSize="20971520"
>
<readerQuotas maxDepth="32"
maxArrayLength="20971520"/>
<security>
<transport sslProtocols="None" />
</security>
</binding>
</netTcpBinding>
</bindings>
i also try get logs(on client side)
<system.diagnostics>
<sources>
<source name="System.ServiceModel.MessageLogging" switchValue="Warning,ActivityTracing">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add name="ServiceModelMessageLoggingListener">
<filter type="" />
</add>
</listeners>
</source>
<source propagateActivity="true" name="System.ServiceModel" switchValue="Warning,ActivityTracing">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add name="ServiceModelTraceListener">
<filter type="" />
</add>
</listeners>
</source>
</sources>
<sharedListeners>
<add initializeData="L:\Projects\Service\Client\Client\App_messages.svclog"
type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp">
<filter type="" />
</add>
<add initializeData="L:\Projects\Service\Client\Client\App_tracelog.svclog"
type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
<filter type="" />
</add>
</sharedListeners>
<trace autoflush="true" />
</system.diagnostics>
but it just doesn't work! it doesn't even generate a .svclog file. i've seen a lot of topics here about this problem, but I couldn't find anything that could help me. the only hope is for the local overmind
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在服务端的
中,您应该将bindingConfiguration="myBind"
添加到您的绑定中,例如in
<endpoint>
on service side you should addbindingConfiguration="myBind"
to you binding like