views:

84

answers:

4

Hi there,

I have some silverlight code that calls a WCF service which then uses the Entity Framework to access the database and return records.

Everything runs fine but ... when I replace the Entity Framework code with classic ADO.NET code I get an error:

The remote server returned an error: NotFound

When I call the ADO.NET code directly with a unit test it returns records fine so it's not a problem with the ADO.NEt code

I used fiddler and it seems to say that the service cannot be found with a "500" error.

i don't think it's anything to do with the service as the only thing I change is the technology to access the database.

Anyone know what i'm missing here?

A: 

'NotFound' is a generic error message that could mean just about anything. If you are absolutely positive that you haven't changed the service interface, then the likely candidate is an exception is being thrown from within your service. Are you sure that the collection type that contains the data you are trying to return hasn't changed, i.e. from List< OfSomthing> to List< OfSomethingElse>?

In any case, something i have found invaluable for tracking this sort of issue is the Service Trace Viewer tool from Microsoft. Read all about it right here, all it takes is some simple changes to your web.config to enable the logging.

slugster
A: 

John Papa has a great article from MSDN Magazine Data Performance and Fault Strategies in Silverlight 3 that explains this issue and offers a solution. Due to browser limitations, error code 500s aren't routed properly. His solution modifies the outgoing HttpResponse Message back to a 200 for all Silverlight 500 responses.

bendewey
A: 

If you are still stuck, you may want to try making the call to the service from the machine hosting the service. IIS by default returns much more information about what might have gone wrong when the call is from the local machine. (I believe this can be changed, but don't know for sure.)

Kirk
A: 

try to add

HttpWebRequest.RegisterPrefix("http://", WebRequestCreator.ClientHttp);

to the Application startup event of the Silverlight app.

It should give you detail of what the real error is rather than NotFound. In my case, i was missing the clientaccesspolicy.xml resuired for cross domain requests.

How to: Specify Browser or Client HTTP Handling

Mike