locked
wcf communication error RRS feed

  • Question

  • Hi,
    I have created a solution with the following projects.
    Web project to host the silverlight app
    Silverlight project with silverlight pages.
    wcf project.

    All compiles.

    I have added the wcf as service references to the silverlight application.
    There is a clientaccesspolicy.xml folder inside the wcf project

    Do you see why the following error occurs please?
    Thanks

    The error I get is:
    CommunicationException was unhandled by user code
    The remote server returned an error: NotFound.


    This is the code in the silverlight page:

    private void UserControl_Loaded(object sender, RoutedEventArgs e)
            {
                myService.myClient client = new myService.myClient();
                client.GetAllDataCompleted += new EventHandler<myService.GetAllDataCompletedEventArgs>(client_GetAlldataCompleted);
                client.GetAlldataAsync();
            }

            private void client_GetAllDataCompleted(object sender, myService.GetAllDataCompletedEventArgs e)
            {
                grid.DataContext = e.Result;
            }

    Tuesday, December 14, 2010 5:54 AM

Answers

  • Solved the first problem and data seems to be returning.

    in e.result I can see data being returned as it shows the count.
    Now the problem is that i can not populate the datagrid.
    i.e. drif.datacontext = e.result

    Not sure why the grid does not get populated.
    Any thoughts please?

    Tuesday, December 14, 2010 11:33 AM
  • your bindings are probably incorrect.

    considering we've already addressed 3 completely separate issues, you'd probably find more help if you started a new thread asking for help on this specific issue.  you may also want to provide more information than "the datagrid isn't getting populated"

    Tuesday, December 14, 2010 12:56 PM
  • solved by using itemsource
    Thank  you all.

    Wednesday, December 15, 2010 2:18 AM

All replies

  • NotFound can mean a lot of things.  one of the big ones is that there's an exception being thrown on the server by the method being called.

    add some logging to the serverside "GetAllData" method and see if it does what you think its doing.

    Tuesday, December 14, 2010 8:31 AM
  • How Do I add logging?
    Do you mean to add to a log file?
    Thanks

    Tuesday, December 14, 2010 8:58 AM
  • thats up to you.  write to a log file or figure out a way to debug into it, etc.  the point is you need to figure out if that method is throwing an exception.

    Tuesday, December 14, 2010 9:23 AM
  • How is it possible to step into the wcf?

    Tuesday, December 14, 2010 9:27 AM
  • make a regular wpf/winforms app and add the assembly as a reference.  make a button, and call the method on button click.  then you can use breakpoints like normal and step into the code.

    otherwise just make a Log(string data) method that writes to a file and litter your method with it.  again, you just need to know if its throwing an error...

    Tuesday, December 14, 2010 9:58 AM
  • I am now writing to a log file...
    The error seems to be:

    Cannot find the object 'mystoredproc', because it does not exist or you do not have permission.

    I can run mystoredproc in sql server and it returns data.
    Not sure what is wrong.
    Any thought please?
    Thanks

    Tuesday, December 14, 2010 10:50 AM
  • then look at the second part of the error: "or you do not have permission".  *YOU* can run it in sql server management studio, but can your code?

    Tuesday, December 14, 2010 11:11 AM
  • Solved the first problem and data seems to be returning.

    in e.result I can see data being returned as it shows the count.
    Now the problem is that i can not populate the datagrid.
    i.e. drif.datacontext = e.result

    Not sure why the grid does not get populated.
    Any thoughts please?

    Tuesday, December 14, 2010 11:33 AM
  • your bindings are probably incorrect.

    considering we've already addressed 3 completely separate issues, you'd probably find more help if you started a new thread asking for help on this specific issue.  you may also want to provide more information than "the datagrid isn't getting populated"

    Tuesday, December 14, 2010 12:56 PM
  • solved by using itemsource
    Thank  you all.

    Wednesday, December 15, 2010 2:18 AM