none
WCF, citrix, async methods RRS feed

  • Question

  • Hi,

    I created a wcf service that uses async methods to perform operatinos etc.

    Locally the app works fine the wcf service doesn't fail. but wshen the user accesses the app in citrix they get a lot of bad request 400 errors. my colleague took a guess and told me that i should close my service proxy down after each wcf service emthod is executed (I keep it open for the lifetime of the particular screen it was opened in).

    i'm going to do this but I was wonderinf if anyone has encountered this issue before - the error definetly seems random.

    Wednesday, June 20, 2012 11:09 AM

Answers

  • K seems in Citrix your communication channel has faulted.

    I would encourage you to enable WCF tracing on server end and use a network sniffer to see what is happening inside.

    For me it was working well with both sync and async call. This can be a version issue but not sure.


    Lingaraj Mishra

    • Marked as answer by Pritesh3 Thursday, June 21, 2012 5:01 PM
    Wednesday, June 20, 2012 3:10 PM

All replies

  • The best practice is to call .Close() on your service proxy after each call.  Call it in a finally block and ensure to check to see if the state on the proxy is .Opened first.

    I worked with similar Environment (Citrix) and does not encounter any issue.


    Lingaraj Mishra

    Wednesday, June 20, 2012 11:54 AM
  • Hi,

    Thanks for responding.

    After doing testing etc. I started closing and openiong all proxies (on the screen where the problem occurred). The error still ocurred. then I thought lets make the calls in that screen synchronous (I was using asynchronous) before and the issue went away.

    I thought this was a citrix issue becaue locally no exceptions are thrown. but now that is an aysnchronous isse i think there mst be some setting that i dont have that makes asnyc methods "safe2 in wcf and critix.

    Have you never encountered this type of issue before?

    Thanks.

    Wednesday, June 20, 2012 1:27 PM
  • K seems in Citrix your communication channel has faulted.

    I would encourage you to enable WCF tracing on server end and use a network sniffer to see what is happening inside.

    For me it was working well with both sync and async call. This can be a version issue but not sure.


    Lingaraj Mishra

    • Marked as answer by Pritesh3 Thursday, June 21, 2012 5:01 PM
    Wednesday, June 20, 2012 3:10 PM
  • Hi Lingaraj,

    You are spot on. Thank you so much for your help.

    It turned out one async call was closing and leaving the service in a bad state when it finished its method and causing the service method i was investigating to crash. A lot of testing later I relaised that if i put a message box in my method the service method never faulted.

    I started guarding against closing and opening as you suggested and it worked perfectly.  

    Thursday, June 21, 2012 5:01 PM