Search code examples
c#.netwcfsilverlightria

System.ServiceModel.DomainServices.Client.DomainOperationException: Load operation failed for query


I am getting the following error in WCF+Silverlight+RIA Service application. It's happening only on production DB.

I copied the production DB to my development machine, I am getting that error when I point the web.config to my production DB from development environment. If I point to test DB then everything works fine.

So I thought that some mismatch problem in DB so I tried to compare test and production DB and all the DB structures are same.

This error occurs only on one function/query 'GetEventViewAll', all other operations are working on that DB. So I thought that the function 'GetEventViewAll' returns more rows, so I deleted all rows on that table, but still getting that error.

This error happens only on production DB, not production environment. I am using same machine, same code, same VS2010. I am just making changes only on web.config to point other DB(production) then getting error.

Could anyone please tell me what I missed or what needs to be done?

the error from output window of VS2010 is: {System.ServiceModel.DomainServices.Client.DomainOperationException: Load operation failed for query 'GetEventViewAll'. The remote server returned an error: NotFound. ---> 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__DisplayClassa.b__9(Object sendState) at System.Net.Browser.AsyncHelper.<>c__DisplayClass4.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.DomainServices.Client.WebDomainClient1.EndQueryCore(IAsyncResult asyncResult) at System.ServiceModel.DomainServices.Client.DomainClient.EndQuery(IAsyncResult asyncResult) at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult) --- End of inner exception stack trace ---} [System.ServiceModel.DomainServices.Client.DomainOperationException]: {System.ServiceModel.DomainServices.Client.DomainOperationException: Load operation failed for query 'GetEventViewAll'. The remote server returned an error: NotFound. ---> 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__DisplayClassa.<EndGetResponse>b__9(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.DomainServices.Client.WebDomainClient1.EndQueryCore(IAsyncResult asyncResult) at System.ServiceModel.DomainServices.Client.DomainClient.EndQuery(IAsyncResult asyncResult) at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult) --- End of inner exception stack trace ---} Data: {System.Collections.ListDictionaryInternal} InnerException: {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__DisplayClassa.b__9(Object sendState) at System.Net.Browser.AsyncHelper.<>c__DisplayClass4.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.DomainServices.Client.WebDomainClient`1.EndQueryCore(IAsyncResult asyncResult) at System.ServiceModel.DomainServices.Client.DomainClient.EndQuery(IAsyncResult asyncResult) at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)} Message: "Load operation failed for query 'GetEventViewAll'. The remote server returned an error: NotFound." StackTrace: null


Solution

  • It's resolved by adding Query-HasSideEffects attribute to the function.

    [Query(HasSideEffects = true)]    //<--- this line solved the problem
    public IQueryable<EventView> GetEventView(List<string> siteName)
    {
     .....
    }
    

    I passed a list to that function. That list is filled from a table. Test DB has less values, production DB has more values, the list count was more in production db. So I got the following error

    The Maximum URI length of 2083 was exceeded
    

    so I put Query attribute to that function to resolve!