Freigeben über


How to resolve “Not Found” Error in Silverlight for WCF RIA Services Calls

If you are trying to figure out why your WCF RIA Service's method calls(or just the regular WCF Service for that matter) throwing the infamous “NotFound” error, you are at the right place. This is basically Silverlight’s way of telling that an exception occurred while the Silverlight runtime tried to make a service call. So, if you are in a similar situation, here are few options that should resolve this issue.

You will get a variation of an error message like this:

"Load operation failed for query 'MyQueryxxxx'. The remote server returned an error: NotFound

Finding out the detailed underlying error would be your first step. By default, the customErrors element of a Web.config file is set to RemoteOnly, which means a remote client will not receive the detailed ASP.NET error information. To debug your application, set customErrors to Off so that you can see the detailed ASP.NET error from the client.

 

Resolution (you may need to perform one or more of the following steps):

#1: Check the database connection string that your Entity Model is using. Make sure the connection string is valid. You can verify it via a simple UDL test.

#2: Is version of your RIA component on the Server “exactly” same as what you have in your Development machine? They MUST match; otherwise you will get this “Not Found” error. This is one of the most common scenarios that we usually see. You can check the RIA component version via Control Panel:

If they don’t match, uninstall it from the Server and reinstall the version matching with your Development machine.

#3: Does your \bin folder on the Server have another \bin folder inside? If so, you need to remove the extra one:

 

Further Troubleshooting:

Above are the most common resolutions for this infamous “Not Found” error. If the above steps don’t resolve your issue, then do a deep dive into tracing the error details. All exceptions originating from within a domain service are sent to the Silverlight client with an error status code of 200. All exceptions thrown at the WCF layer or lower are sent to the Silverlight client with a status code of 404. You can run following traces to get the exact exception information from the server:

-Use IE10’s Tools-->F12 option to capture network traces

-3rd party web sniffing tools like HTTPWatch (not a recommendation, just for illustration only)

Comments

  • Anonymous
    January 14, 2013
    A good solution for #2 is to use the new RiaServices.Server NuGet package. The new package's dlls are automatically set to copy local and they have a new version on them so they override any dlls that are installed on the server. The official troubleshooting document for WCF RIA Services can be found at msdn.microsoft.com/.../ff426913(v=VS.91).aspx which has more tips you can try.