1
我的一个WCF服务有一个操作协定,它将一个大文件作为参数。所以,当客户端尝试这个送过来,我有一个例外,当我看着服务器跟踪,这是我所看到的:WCF - 没有端点监听
消息:传入消息(65536) 具有最大邮件大小配额已超过。要增加配额,请在适当的绑定元素上使用MaxReceivedMessageSize属性。
我是用我的WCF服务的默认简化的配置,所以增加了新的服务定义如下:
<system.serviceModel>
<services>
<service name="MyNamespace.MyService">
<endpoint address="MyService.svc"
binding="basicHttpBinding" bindingConfiguration="basicHttp"
contract="MyNamespace.IMyService" />
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="basicHttp" allowCookies="true"
maxReceivedMessageSize="10485760"
maxBufferSize="10485760"
maxBufferPoolSize="10485760">
<readerQuotas maxDepth="32"
maxArrayLength="10485760"
maxStringContentLength="10485760"/>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
...
</behaviors>
<protocolMapping>
...
</protocolMapping>
我消耗我的服务的方式是,我有一个函数在我的帮手类中返回一个频道,并使用该频道调用操作:
public static T CreateChannel<T>() where T : IBaseService
{
System.ServiceModel.BasicHttpBinding binding= new System.ServiceModel.BasicHttpBinding();
binding.TransferMode = TransferMode.Streamed;
binding.Security = new BasicHttpSecurity() { Mode = BasicHttpSecurityMode.None };
binding.MaxReceivedMessageSize = 10485760;
binding.MaxBufferSize = 10485760;
System.ServiceModel.ChannelFactory<T> cf2 = new ChannelFactory<T>(binding,
new System.ServiceModel.EndpointAddress(MyEndpointAddress)); //I checked this part, the address is correct.
T Channel= cf2.CreateChannel();
return Channel;
}
and the N,
var businessObject = WcfHelper.CreateChannel<IMyService>();
var operationResult = await businessObject.MyOperationAsync(...);
即使,我的其他服务都正常运行,我在配置中定义的一个明确返回异常“没有终点的聆听......”我开发在VS2012,使用IISExpress。可能是什么问题,有什么建议?
感谢您的文章,但传输模式设置没什么区别,我只是尝试不同的东西+我作为参数传递的文件大于65536字节,小于10MB。 –
@ F.Erken见编辑 – Cybermaxs
已经检查过,没有运气。 –