Strange but true, I was getting below error.
{System.Reflection.TargetInvocationException: An exception occurred during the operation, making the result invalid. Check InnerException for exception details. ---> System.ServiceModel.CommunicationException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound.
at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
at System.Net.Browser.AsyncHelper.<>c__DisplayClass4.<BeginOnUI>b__1(Object sendState)
--- End of inner exception stack trace ---
at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
--- End of inner exception stack trace ---
at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)
at SilverlightDataAccessApp.ServiceReference1.DemoServiceClient.DemoServiceClientChannel.EndLoad(IAsyncResult result)
at SilverlightDataAccessApp.ServiceReference1.DemoServiceClient.SilverlightDataAccessApp.ServiceReference1.DemoService.EndLoad(IAsyncResult result)
at SilverlightDataAccessApp.ServiceReference1.DemoServiceClient.OnEndLoad(IAsyncResult result)
at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)
--- End of inner exception stack trace ---
at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
at SilverlightDataAccessApp.ServiceReference1.LoadCompletedEventArgs.get_Result()
at SilverlightDataAccessApp.MainPage.client_LoadCompleted(Object sender, LoadCompletedEventArgs e)
at SilverlightDataAccessApp.ServiceReference1.DemoServiceClient.OnLoadCompleted(Object state)} This error was because my ADO.NET Entity framework had other tables that was related with my main table (primary foreign key relations). I removed the reference of foreign table from my ADO.NET Entity framework and the problem got resolved.
When you are directly returning the table name entity object to the service you and your table is referenced with primary key and foreign key, you may get this kind of error.
Thanks
Regards,
Sheo Narayan
http://www.dotnetfunda.com