I’m trying to share you a problem we got while consuming WCF Service and how did we solve
it. Which will help you debugging WCF.
While consuming WCF service we got error message “The remote server returned an
unexpected response: (400) Bad Request.”.
In that Message I didn’t understand what Bad means. It would be helpful if we are having more detailed information on what Bad means?
it. Which will help you debugging WCF.
While consuming WCF service we got error message “The remote server returned an
unexpected response: (400) Bad Request.”.
In that Message I didn’t understand what Bad means. It would be helpful if we are having more detailed information on what Bad means?
To know this we need to enable tracing at WCF Service end.
To enable tracing add below config entries in your service config file under configuration.
<system.diagnostics> <sources> <source name="System.ServiceModel" switchValue="Warning"> <listeners> <add name="WcfLogSample" /> </listeners> </source> </sources> <sharedListeners> <add name="WcfLogSample" type="System.Diagnostics.XmlWriterTraceListener" initializeData="D:\log\Traces2.svclog" traceOutputOptions="Callstack" /> </sharedListeners> <trace autoflush="true" /> </system.diagnostics> |
Then try to reproduce the error from client again and open File "D:\log\Traces2.svclog" .where you can see detailed error message as below
“The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.” "
Then simply go ahead and increase value MaxReceivedMessageSize. Now the problem is solved
What I’m trying to say here is, make your life easy while debugging by enabling tracing
in WCF when we get weird error.
in WCF when we get weird error.
Hope this helps
Vital
No comments:
Post a Comment