locked
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

Answers

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
                Get
                    Return Me._friendlyName
                End Get
                Set
                    If (String.Equals(Me._friendlyName, value) = false) Then
                        Me.OnFriendlyNameChanging(value)
                        Me.RaiseDataMemberChanging("FriendlyName")
                        Me.ValidateProperty("FriendlyName", value)
                        Me._friendlyName = value
                        Me.RaiseDataMemberChanged("FriendlyName")
                        Me.OnFriendlyNameChanged
                    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?

    http://msdn.microsoft.com/en-us/library/ff426913(v=VS.91).aspx

    http://msdn.microsoft.com/en-us/library/ff426912(v=vs.91).aspx

     

     

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

    IE8

    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:

    http://social.msdn.microsoft.com/Forums/en-US/silverlightwcf/thread/b6081e18-3f48-4298-9fc5-0af1e3794641#e65e1f0c-13b0-45f8-a7e9-f2c1241dc2b9/1?p=True&t=634814123240821091

    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:
    <system.serviceModel>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
          multipleSiteBindingsEnabled="true" />
        <behaviors>
          <serviceBehaviors>
            <behavior name="RIAServicesExample-Web-CustomerDomainSerivce">
                <dataContractSerializer maxItemsInObjectGraph="3"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>
    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:

     <services>
          <service name="Test"
                  behaviorConfiguration="Hello">
          </service>
        </services>
     
        <behaviors>
          <serviceBehaviors>
            <behavior name="Hello">
                <dataContractSerializer maxItemsInObjectGraph="3"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>
    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:

    MyCompany.SomeNamespace.MoreNameSpace.Web.MyDomainService

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

    MyCompany-SomeNamespace-MoreNameSpace-Web-MyDomainService


    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:

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

    RIAServicesExample-Web-CustomerDomainSerivce


    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"?>
    <configuration>
      <configSections>
        <sectionGroup name="system.serviceModel">
          <section name="domainServices" type="System.ServiceModel.DomainServices.Hosting.DomainServicesSection, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" allowDefinition="MachineToApplication" requirePermission="false" />
        </sectionGroup>
      </configSections>
      <connectionStrings>
        <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" />
      </connectionStrings>
      <system.web>
        <httpModules>
          <add name="DomainServiceModule" type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        </httpModules>
        <compilation debug="true" targetFramework="4.0">
          <assemblies>
            <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
          </assemblies>
        </compilation>
        <globalization culture="auto" uiCulture="auto" />
        <authentication mode="Forms">
          <forms name=".BusinessApplication2_ASPXAUTH" timeout="2880" />
        </authentication>
        <membership>
          <providers>
            <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="/" />
          </providers>
        </membership>
        <roleManager enabled="true">
          <providers>
            <clear />
            <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
            <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
          </providers>
        </roleManager>
        <profile>
          <providers>
            <clear />
            <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
          </providers>
          <properties>
            <add name="FriendlyName" />
          </properties>
        </profile>
      </system.web>
      <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
        <modules runAllManagedModulesForAllRequests="true">
          <add name="DomainServiceModule" preCondition="managedHandler" type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        </modules>
      </system.webServer>
      <system.serviceModel>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
        <services>
          <service name="BusinessApplication2.CustomerDomainService"
                  behaviorConfiguration="BusinessApplication2-CustomerDomainService">
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="BusinessApplication2-CustomerDomainService">
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="true" />
              <dataContractSerializer maxItemsInObjectGraph="655360"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>
      </system.serviceModel>
    </configuration>

    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:

     <system.serviceModel>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
          multipleSiteBindingsEnabled="true" />
        <services>
          <service name="RIAServicesExample.Web.CustomerDomainService"
                  behaviorConfiguration="RIAServicesExample-Web-CustomerDomainService">
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="RIAServicesExample-Web-CustomerDomainService">
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="true" />
              <dataContractSerializer maxItemsInObjectGraph="13000"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>
      </system.serviceModel>
    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:

    http://www.riaservicesblog.net

    http://bit.ly/pgL97k

    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