WCF服务 - 动态代理上的400错误请求错误

时间:2016-05-06 14:34:32

标签: c# wcf

我正在使用WCF服务在静态IP上创建动态代理。 Url =“http://”+ staticIP +“/ CM.svc”

BasicHttpBinding binding = new BasicHttpBinding();

还有set binding.MaxReceivedMessageSize = 2147483647; Maxbuffersize,MaxbufferPoolsize,Receivetimeout,Opentimeout,closetimeout,sendtimeout,transferMode ......

EndpointAddress endpoint = new EndpointAddress(Url);
ChannelFactory<ICMOnlineApp> factory = new ChannelFactory<ICmOnlineApp>(binding, endpoint);

foreach(var operation in factory.Endpoint.Contract.Operations)
{
operation.Behaviors.find<DataContractSerializerOperationBehavior>().DataContractResolver = new DynamicTypeResolver();

 ICMOnlineApp proxy = factory.CreateChannel();

return proxy;

}

此外,我已完成WCF服务的web.config文件中的所有设置。

我仍然收到此错误。请指导。

2 个答案:

答案 0 :(得分:0)

对于WCF中显示的错误,跟踪看起来就像您要发送消息的服务一样,不允许该消息大小。

"The maximum message size quota for incoming messages(65536) has been exceed"

更改WCF服务和客户端的配置,以允许该大小的消息:

<bindings>
    <basicHttpBinding>
        <binding name="basicHttp" allowCookies="true"
                 maxReceivedMessageSize="2147483647" 
                 maxBufferSize="2147483647"
                 maxBufferPoolSize="2147483647">
            <readerQuotas maxDepth="32" 
                 maxArrayLength="2147483647"
                 maxStringContentLength="2147483647"/>
        </binding>
    </basicHttpBinding>
</bindings>

答案 1 :(得分:0)

尝试在web.config和类中使用以下配置:

Web.config:

TwoWay

代码:

BackgroundColor
相关问题