locked
WCF async calls and ASP.NET RRS feed

  • Question

  • Hi guys,

    I have an asp.net asyncronous page, this page is inherted from a base page that has a wcf proxy client that can be use din my page.
    Now, in the page load, I register 3 asynk tasks and execute it, the client retruns an error saying "Async End called on wrong channel.Parameter name: result".
    I figured it out this may be a reason due that I am reusing the same proxy instance for all 3 async task.

    first question is..can u point to me why the actual error i comming?
    secondly, whats the best way to overcome this issue? create a proxy everytime? then how am i to know which proxy to invole the ENDXXX() method?

    Regards,
    Nairooz Nilafdeen
    Tuesday, November 17, 2009 6:00 AM

Answers

  • Hi Nairooz,

    Please post your code snippet so that we can know your situation.

    You can pass client to know which proxy is involing the ENDXXX() method.

     client.BeginSubtract(23.23d, 122.23d, AsyncCallbackHandler, client);

            static void AsyncCallbackHandler(IAsyncResult ar)
            {
                Console.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + "  Begin callback");

                CalculatorClient client = ar.AsyncState as CalculatorClient;

                if (client != null)
                    Console.WriteLine("Subtract() value: {0}", client.EndSubtract(ar));
            }
    Best regards,
    Riquel
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Riquel_Dong Monday, November 23, 2009 1:44 AM
    Friday, November 20, 2009 9:32 AM
  • My BAD, I was using a different proxy when I call EndXXX() ,

    Tx
    Monday, November 23, 2009 7:15 AM

All replies

  • Hi Nairooz,

    Please post your code snippet so that we can know your situation.

    You can pass client to know which proxy is involing the ENDXXX() method.

     client.BeginSubtract(23.23d, 122.23d, AsyncCallbackHandler, client);

            static void AsyncCallbackHandler(IAsyncResult ar)
            {
                Console.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + "  Begin callback");

                CalculatorClient client = ar.AsyncState as CalculatorClient;

                if (client != null)
                    Console.WriteLine("Subtract() value: {0}", client.EndSubtract(ar));
            }
    Best regards,
    Riquel
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Riquel_Dong Monday, November 23, 2009 1:44 AM
    Friday, November 20, 2009 9:32 AM
  • My BAD, I was using a different proxy when I call EndXXX() ,

    Tx
    Monday, November 23, 2009 7:15 AM