Q2 2010, The remote server returned an error: NotFound

Thread is closed for posting
2 posts, 0 answers
  1. Pullan
    Pullan avatar
    1 posts
    Member since:
    Jul 2010

    Posted 13 Aug 2010 Link to this post

    I created a solution and tried to build a program from zero according to Silverlight SalesDashboard Demo. I used OpenAccess to generate Domain Model. Database northwind comes from the Demo.
    I noticed the employee class in Employees.generated.cs includes the below two fields:

     

    private IList<Employee> employees1 = new List<Employee>();

            [Collection(InverseProperty = "ReportsTo")]
            [Storage("employees1")]
            public virtual IList<Employee> Employees1
            {
                get
                {
                    return this.employees1;
                }
            }

            private IList<Order> orders = new List<Order>();

            [Collection(InverseProperty = "Employee")]
            [Storage("orders")]
            public virtual IList<Order> Orders
            {
                get
                {
                    return this.orders;
                }
            }

     Then I wrote WCF service according to demo and added it into Shell project as service reference. When testing functions such as GetRepresentatives, I would get error "The remote server returned an error: NotFound" at

    System.Collections.ObjectModel.ObservableCollection<Telerik.SalesDashboard.Shell.
    SalesDashboardServiceReference.Employee
    _result = 
    ((System.Collections.ObjectModel.ObservableCollection<Telerik.SalesDashboard.Shell.
    SalesDashboardServiceReference.Employee
    >)(base.EndInvoke("GetRepresentatives", 
    _args, result))); <BR>

    Seems the type Employee cannot be recognized. I tried many ways, finally, I removed the above two fields. The error disappeared. But I don't know why.

  2. Petko_I
    Admin
    Petko_I avatar
    184 posts

    Posted 18 Aug 2010 Link to this post

    Hello Pullan,

    The troubles you are experiencing are due to WCF serialization issues. Using the persistent classes to travel with service method invocations is not recommended in general. The persistent objects are tightly related to the context (scope) that manages them and this context cannot be serialized and sent through the service. The list collections (the many side of a one-to-many relationship) that you have deleted to make your service work define circular referencing – the Employee persistent class has many Orders and an Order has an Employee reference. The recommended approach when implementing custom WCF services  is to use specially designed objects which repeat the definition of the persistent classes and which are capable to be serialized. In order to link the persistent classes with the serializable ones you can use the assembler pattern. The following Northwind WCF N-tier Demo is developed with best practices in WCF handling. It may seem a bit complicated but spending time to understand it is worth the effort.  The application is not Silverlgiht-based but it revolves around the WCF issues you are facing.

    If you need simpler scenarios where WCF services are not in the limelight you can benefit from following the Quickstart examples:

    Silverlight 4 – Using WCF RIA Services

    Silverlight 4 – Using WCF Data Services

    Do not hesitate to contact us if you need further assistance.


    Regards,
    Petko_I
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top