ASMX web service help how to set the MaxReceivedMessageSize equivalent

A web service is an ASMX web service (NOT WCF)

I get an error

Exceeded maximum message size quota for incoming messages (65536). To increase the quota, use the MaxReceivedMessageSize property in the corresponding binding element

I use a proxy server that Visual Studio generates for you when you add a “Web link” (note that I am NOT adding a “Service link”, I use a web link instead) ... this creates a proxy server inherits from SoapHttpClientProtocol

Can someone help me figure out how to set the MaxReceivedMessageSize equivalent for this method? (I ask for the equivalent to do HttpBinding.MaxReceivedMessageSize = Int32.MaxValue if I use WCF)

+6
source share
3 answers

Changing MaxReceivedMessageSize can be done in the App.config file or in the source code before calling the service method.

  BasicHttpBinding httpBinding = youAddWebServiceName.ChannelFactory.Endpoint.Binding as BasicHttpBinding; httpBinding.MaxReceivedMessageSize = int.MaxValue; 
+4
source

Maybe this helps someone. I get the same error message in the ASMX web service, but not from the server! it was from the client, and I just add it to the client configuration:

 <basicHttpBinding> <binding name="BindingName" maxBufferPoolSize="20000000" maxReceivedMessageSize="20000000" maxBufferSize="20000000" /> </basicHttpBinding> 
+4
source

This post is specific to WCF. I suspect that you are calling your ASMX service through a WCF proxy (client class inherits from ClientBase ). A typical ASMX proxy, on the other hand, inherits from SoapHttpClientProtocol .

The trick is that if you just added a service link in Visual Studio, a WCF-like proxy is created by default. To create an old type proxy server, you must click "Advanced" in the proxy creator's dialog box and then "Add a service link" in the advanced properties dialog box or call the wsdl.exe tool from the command line.

A proxy created in the "old" has no message quotas.

However , using legacy ASMX technology for both server and client is not recommended .

+2
source

Source: https://habr.com/ru/post/971881/


All Articles