Thursday, June 7, 2012

Remote server return an error from WCF service.

We get this error if there is any error between client and server which  means you will not have clue what exactly the issue is.

To figure out what exactly the issue is very simple.
You need to diagnose your WCF service service which will tell you where is the problem.

To enable diagnostic for you WCF service is



  <system.diagnostics>
    <sources>
      <source name="System.ServiceModel"
              switchValue="Information, ActivityTracing"
              propagateActivity="true">
        <listeners>
          <add name="traceListener"
              type="System.Diagnostics.XmlWriterTraceListener"
              initializeData= "c:\Logs\Traces.svclog" />
        </listeners>
      </source>
    </sources>
  </system.diagnostics>

Make sure you have a folder with name Logs under "C" drive or where you place and and have permission to create to files under that folder. 

Then run your application and and follow the process that gives you the error. After error close the Visual studio and open Traces.svclog. You will see error on the left hand side in red color and you will find the description on the right side. Then you can easily fix your issue with Remote Server returned an error.

The most common causes for this error is
1. Mismatch Binding
2. Mismatch of DataContract
3. Total data size exceeds the limit and many more but using this diagnostic tools makes your life easier to find out what exactly is the reason for your application to get this error.

Leave your question/suggestions on this if have any.

Cheers!
Vinod







No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog