none
Difficulty troubleshooting an issue RRS feed

  • Question

  • using (DataContext context = new DataContext())
          {
            DataLoadOptions dlo = new DataLoadOptions();
            dlo.LoadWith<Job>(theJob => theJob.JobInventories);
            dlo.LoadWith<Job>(theJobAgain => theJobAgain.CustomInventoryItems);
            context.LoadOptions = dlo;
            var theJob2 = (from newJob in context.Jobs
                   where newJob.JobNumber.Equals(userId)
                   select newJob).FirstOrDefault();
            if (theJob2 == null)
            {
              throw new Exception("No job associated with the userId. Id = " + userId);
            }
    
            var thePerson = (from newPerson in context.Person
                    where newPerson.JobNumber.Equals(userId)
                    select newPerson).FirstOrDefault();
            if (theLead == null)
            {
              throw new Exception("No person associated with the userId. UserId = " + userId);
            }
    
            lj.job = theJob2;
            lj.lead = thePerson;
    
          }
    

    I have a webmethod that returns a complex type.  I call the webmethod from a silverlight app.  I can trace the code through the webmethod and all seems well, the linq query shows results.  I then return the complex type (essentially and object that holds two other objects).  I am getting an error in Reference.cs stating CommunicationException was unhandled by userCode.  The remote server returned an error: NotFound.

    I orginially though the issue was because of the objects returned (Job) has two foreign keys which are not loaded in the one trip to the database?  I then started researching the DataLoadOptions and the loadWith method.  I believe that is working as it should but I still get the error.  Below are some details about the objects and example code:

    schema

    Job: JobName, JobInventoryId, JobCustomInventroyId

    JobInventoryId and JobCustomInventoryId are foreign keys

    person:  (no foreign keys)

    lj in the code is just a container to return both objects from the queries.  Is there something with this query that is causing the server not found issue?

    Friday, October 22, 2010 6:26 PM

Answers

  • Set up a trace on your service.. Then view the log file, these tend to give a bit more information regarding the exception.
    • Marked as answer by liurong luo Friday, October 29, 2010 10:31 AM
    Saturday, October 23, 2010 9:27 AM

All replies

  • Set up a trace on your service.. Then view the log file, these tend to give a bit more information regarding the exception.
    • Marked as answer by liurong luo Friday, October 29, 2010 10:31 AM
    Saturday, October 23, 2010 9:27 AM
  • Hello,

    One of the tools to trouble shoot web applications is Fiddler. But since there is a service layer in your application, I suspect if is related to the serialization for your complex type objects. Here is a similar thread, hope it could help you (insead of web service, it uses WCF service): http://forums.silverlight.net/forums/p/135302/302100.aspx

    If you provide us more information (code snippet, detail steps or a small project) to reproduce the issue, that's would be really helpful.

    Best regards


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback, please tell us.
    Welcome to the All-In-One Code Framework!
    Tuesday, October 26, 2010 8:18 AM