Results 1 to 4 of 4

Thread: WCF, Begin/End asynch, OperationContext.Current

  1. #1
    lordofduct is offline VB.NET Forum Enthusiast
    .NET Framework
    .NET 3.5
    Join Date
    Jun 2010
    Posts
    71
    Reputation
    111

    WCF, Begin/End asynch, OperationContext.Current

    So I have a WCF service that runs, and sometimes I want to call to the server asynchronously.

    Basically I follow the Begin/End outline to do the call. WCF takes care of a asynchronous call when I do this, which means I'm not struck with any 'timeouts' if the service takes a while, it just responds back once it's done. Yey.

    On the service I grab a reference to the current OperationContext so I can get the sessionId. I have a few persistent values stored by the sessionId... so this way I know who called and what of these values to use.

    But the thing is OperationContext.Current is NOTHING if I do this Begin/End asynch call to the WCF service. Does anyone know why? Does anyone know how I can work around this?

  2. #2
    JohnH's Avatar
    JohnH is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.5
    Join Date
    Dec 2005
    Location
    Norway
    Posts
    15,080
    Reputation
    2802
    Most likely you are using default BasicHttpBinding, which doesn't support sessions.

  3. #3
    lordofduct is offline VB.NET Forum Enthusiast
    .NET Framework
    .NET 3.5
    Join Date
    Jun 2010
    Posts
    71
    Reputation
    111
    nope...

    the object is there if I don't do an asynch begin/end call

    I'm using ws

    And I just tested, because that sounds weird, and OperationContext.Current does exist in BasicHttpBinding.
    Last edited by lordofduct; 09-24-2010 at 9:38 AM.

  4. #4
    JohnH's Avatar
    JohnH is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.5
    Join Date
    Dec 2005
    Location
    Norway
    Posts
    15,080
    Reputation
    2802
    According to my tests OperationContext.Current does exist in BasicHttpBinding both for sync/ascyn calls, but it never has a session id. According to my research, for example System-Provided Bindings, it also shouldn't since that binding does not support sessions. I was only able to get an id string using other types of bindings, and there were also no difference with sync/async calls.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •