RIA Walkthrough: Load operation failed for query 'GetCustomers'. The remote server returned an error: NotFound. RRS feed

  • Question

  • I have been struggling through 

    Walkthrough: Creating a RIA Services Solution

    for the past week and keep hitting the same ill-defined error (full error below) at runtime.

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

    My platform:

    • Windows 7
    • VS 2010
    • Silverlight 5
    • IIS 7.5
    • SQL Express 

     Things I've tried:

    1) Fiddler: does not record transactions
    2) Tweaking the IIS AppPool.  Using Network Service as Identity.   Using an admin account as Identity. No difference.
    3) Adding IUSR and other accounts to SQL Express and on the AdventureWorks db.
    4) Using SQL auth instead of Windows auth on SQL Express.
    5) Adding crossdomain.xml and clientaccesspolicy.xml ( http://msdn.microsoft.com/en-us/library/cc197955(v=vs.95).aspx )

    At this point I'm simply trying to connect the dots and create the simplest RIA data services application possible, but unable to get past this error.

    I have done extensive searching, and found scores of different answers.

    This one seems easy enough -- perhaps someone in the Silverlight team validate the Walkthrough for my configuration?

    Webpage error details
    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; .NET4.0C; .NET4.0E; Tablet PC 2.0; MS-RTC LM 8)
    Timestamp: Thu, 23 Aug 2012 04:37:04 UTC
    Message: Unhandled Error in Silverlight Application 
    Code: 4004 
    Category: ManagedRuntimeError 
    Message: System.ServiceModel.DomainServices.Client.DomainOperationException: Load operation failed for query 'GetCustomers'. 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__0(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)
    --- End of inner exception stack trace ---
    at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error)
    at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(Exception error)
    at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)
    at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass1b.<Load>b__17(Object )
    Line: 56
    Char: 13
    Code: 0
    URI: http://localhost:57862/SilverlightApplication5TestPage.aspx

    Thursday, August 23, 2012 12:48 AM


All replies

  • Hi

    Try Same thing With Business Application.. 

    Thursday, August 23, 2012 1:17 AM
  • Using the Silverlight Business Application template...same error.

    Things I observe:

    Initially the IE page displays showing the DataGrid, with column headings, but no data.

    Stepping through the code, the debugger makes it past the all the statements in Sub New() in the Main.xml codebehind.

    Dim loadOp = Me._customerContext.Load(Me._customerContext.GetCustomersQuery())
    CustomerGrid.ItemsSource = loadOp.Entities

    However, watching loadOp.Entities, I notice it contains zero records.  This is probably the first problem.

    So after it completes Sub New() it seems to go into some rendering functions.

    At this point, the page in the browser blanks out, and the error is thrown.

    Stepping through the code, it occurs in this method from BusinessApplication.Web.g.vb, right when it hits the End Set.

           ''' <summary>
            ''' Gets or sets the 'FriendlyName' value.
            ''' </summary>
            <DataMember()>  _
            Public Property FriendlyName() As String
                    Return Me._friendlyName
                End Get
                    If (String.Equals(Me._friendlyName, value) = false) Then
                        Me.ValidateProperty("FriendlyName", value)
                        Me._friendlyName = value
                    End If
                End Set
            End Property

    Is it all related to the CustomerGrid.ItemsSource having zero entries?

    Thursday, August 23, 2012 9:36 AM
  • 1) Fiddler: does not record transactions

    What browser are you using? Some browsers do not loop thorugh Fiddler if you are hitting localhost. One easy fix is to change the url to be your computer's name instead of localhost. You are going through the Walkthrough document in MSDN, have you tried the deployment and troubleshooting documents on MSDN?





    Thursday, August 23, 2012 10:34 AM
  • What browser are you using?


    change the url to be your computer's name instead of localhost

    Good idea.  I tried it and it does display the initial call to the website but nothing else after that in the way of an error condition.

    have you tried the deployment and troubleshooting documents

    These look like good resources.

    I'm seeing the same error running in the VS.2010 debugger with the virtual ASP.net server and in deploying to my local workstation IIS.

    I am hoping to be able to fix this in the debugger to be able to continue development.

    Thursday, August 23, 2012 10:49 AM
  • Ok, for some reason all my searching didn't turn up this thread on the current forum which answers my challenge exactly:


    The issue is the query returns too much data.

    The answer is to set up the web.config maxItemsInObjectGraph attribute of the dataContractSerializer.

    The dumb thing is I've used this technique in other WCF web services but somehow it didn't register that it was the problem here (I didn't realize there was so much data in the AdventureWorks db).

     Now working!

    Friday, August 24, 2012 1:42 PM
  • I have the exact same problem.  I tried the fix you mentioned with web.config but it still fails.  I added the <behaviors> section below:
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
          multipleSiteBindingsEnabled="true" />
            <behavior name="RIAServicesExample-Web-CustomerDomainSerivce">
                <dataContractSerializer maxItemsInObjectGraph="3"/>
    Can someone tell me what I am doing wrong?
    Monday, November 12, 2012 6:59 AM
  • Did you give your service a name so it could find the behavior?

    (See Roger G's post in the link to the thread I posted above).       

    <service name="YOURPROJECT.Web.YOURSERVICE" behaviorConfiguration="RIAServicesExample-Web-CustomerDomainSerivce"></service>


    John Bailo RR Donnelley

    • Edited by John Bailo Monday, November 12, 2012 2:15 PM
    Monday, November 12, 2012 2:13 PM
  • Thanks for your prompt reply.  I tried the following:

          <service name="Test"
            <behavior name="Hello">
                <dataContractSerializer maxItemsInObjectGraph="3"/>
    but it did not work.  Do I need to reference the service name "Test" somewhere else? I am a beginning in WCF and somewhat confused.
    Tuesday, November 13, 2012 3:27 AM
  • It is the fully qualified name of your DomainService. For example, if the name of your DomainService is:


    then the name should be the fully qualified name as above and the behaviorConfiguration would be:


    http://www.riaservicesblog.net | RIA Services and MVVM http://bit.ly/pgL97k

    Tuesday, November 13, 2012 3:59 PM
  • Thanks for your comment.  I must be having a cockpit problem.  This is the code I tried in my web.config:

        <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
          multipleSiteBindingsEnabled="true" />
          <service name="RIAServicesExample.Web.CustomerDomainSerivce"
            <behavior name="RIAServicesExample-Web-CustomerDomainSerivce">
                <dataContractSerializer maxItemsInObjectGraph="3"/>
    I still get the "GetCustomers() not found" errror.
    Tuesday, November 13, 2012 8:16 PM
  • You have Service misspelled.


    http://www.riaservicesblog.net | RIA Services and MVVM http://bit.ly/pgL97k

    Tuesday, November 13, 2012 8:20 PM
  • Here's my entire web.config for the build I got working (note I used a "Business Application" but I don't think it's required):

    <?xml version="1.0" encoding="utf-8"?>
        <sectionGroup name="system.serviceModel">
          <section name="domainServices" type="System.ServiceModel.DomainServices.Hosting.DomainServicesSection, System.ServiceModel.DomainServices.Hosting, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" allowDefinition="MachineToApplication" requirePermission="false" />
        <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />
        <add name="AdventureWorksEntities" connectionString="metadata=res://*/AdventureWorksModel.csdl|res://*/AdventureWorksModel.ssdl|res://*/AdventureWorksModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=WA8740AC601978\BAILODEV;initial catalog=AdventureWorks;integrated security=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
          <add name="DomainServiceModule" type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <compilation debug="true" targetFramework="4.0">
            <add assembly="System.Data.Entity, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
        <globalization culture="auto" uiCulture="auto" />
        <authentication mode="Forms">
          <forms name=".BusinessApplication2_ASPXAUTH" timeout="2880" />
            <clear />
            <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
        <roleManager enabled="true">
            <clear />
            <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
            <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
            <clear />
            <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
            <add name="FriendlyName" />
        <validation validateIntegratedModeConfiguration="false" />
        <modules runAllManagedModulesForAllRequests="true">
          <add name="DomainServiceModule" preCondition="managedHandler" type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
          <service name="BusinessApplication2.CustomerDomainService"
            <behavior name="BusinessApplication2-CustomerDomainService">
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="true" />
              <dataContractSerializer maxItemsInObjectGraph="655360"/>

    John Bailo RR Donnelley

    • Edited by John Bailo Tuesday, November 13, 2012 10:40 PM
    Tuesday, November 13, 2012 10:38 PM
  • I found my basic problem.  I redid the example and this time used AdventureWorksLT rather than AdventureWorks (the tutorial says to use AdventureWorksLT).   I did not have to touch web.config and everything works for fine.   Then just for fun I changed my web.config to:

        <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
          multipleSiteBindingsEnabled="true" />
          <service name="RIAServicesExample.Web.CustomerDomainService"
            <behavior name="RIAServicesExample-Web-CustomerDomainService">
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="true" />
              <dataContractSerializer maxItemsInObjectGraph="13000"/>
    and I got the "GetCustomers() not found" error again.  When I bump the number 13000 to 14000 it works fine.   Does anybody have any comment?
    Wednesday, November 14, 2012 6:09 AM
  • If what you are looking for is a good tutorial, I do not recommend the one you are looking at. In my signature is a link for RIA Services and MVVM which will take you to a bit.ly bundle with links to a John Papa video and modifications to John's code by Kyle McClellan and myself. Those are the best practices for creating LOB applications in Silverlight, the tutorial you are looking at is out of date.

    http://www.riaservicesblog.net | RIA Services and MVVM http://bit.ly/pgL97k

    • Proposed as answer by joeprog2 Wednesday, November 14, 2012 5:50 PM
    Wednesday, November 14, 2012 3:56 PM
  • Records that can be returned by GetCustomers() > 13000 and < 14000 ?

    John Bailo RR Donnelley

    • Proposed as answer by joeprog2 Wednesday, November 14, 2012 5:44 PM
    • Unproposed as answer by joeprog2 Wednesday, November 14, 2012 5:44 PM
    • Proposed as answer by joeprog2 Wednesday, November 14, 2012 6:25 PM
    Wednesday, November 14, 2012 4:48 PM
  • Thanks for the links.   For clariy, I broke them up into separate links below:



    You may be right about the number of record returned by GetCustomer().  I probably don't understand the attribute maxItemsInObjectGraph.   However, now it's up to me to do more homework, especially thru your websites.   My major issues have all been resolved.  Thanks for all your comments and links.  

    Wednesday, November 14, 2012 5:50 PM