C# – The remote server returned an error: NotFound. Silverlight + WCF

csilverlightwcf

I'm trying to call web service for few hours.
I have added clientaccesspolicy.xml:

<?xml version="1.0" encoding="utf-8"?>
<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from http-request-headers="*">
        <domain uri="*"/>
      </allow-from>
      <grant-to>
        <resource path="/" include-subpaths="true"/>
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>

and crossdomain.xml:

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
  <allow-http-request-headers-from domain="*" headers="SOAPAction,Content-Type"/>
</cross-domain-policy>

to root directory of my web site.
Web service is called from IIS, and it's working here.

But when I'm trying to call my wcf web service from silverlight application I get this error:

The remote server returned an error: NotFound.

This is log from Fiddler:

a:InternalServiceFaultThe server was unable to process the request due to
an internal error. For more information about the error, either turn
on IncludeExceptionDetailInFaults (either from
ServiceBehaviorAttribute or from the <serviceDebug>
configuration behavior) on the server in order to send the exception
information back to the client, or turn on tracing as per the
Microsoft .NET Framework 3.0 SDK documentation and inspect the server
trace logs.

This is code, when I get an error:

public int EndUserExist(System.IAsyncResult result) {
       object[] _args = new object[0];
       int _result = ((int)(base.EndInvoke("UserExist", _args, result))); //Here
       return _result;
            }

What am I doing wrong?

Best Answer

Look in your web.config for this text: IncludeExceptionDetailInFaults set that to true. Then run your service request again and watch Fiddler this time it will tell you what you need to know. May be anything from a SQL error to a null reference. :-)