且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用 WCF 客户端时如何以编程方式设置 MaxReceivedMessageSize?

更新时间:2022-02-21 22:15:14

您是否尝试过重新排序调用以便在实例化客户端之前设置 MaxReceivedMessageSize?例如,

Have you tried re-ordering the calls so that you set the MaxReceivedMessageSize before instantiating the client? eg,

var binding = new wsHttpBinding();
binding.MaxReceivedMessageSize = Int32.MaxValue; 
var wcfClient = new WCFServiceTestClient(binding, strServiceURL); 

不过,这可能会也可能不会帮助您解决 400 错误.

This may or may not help your 400 error, though.