Results 1 to 2 of 2

Thread: [RESOLVED] WCF Service with callbacks

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2010
    Posts
    259

    Resolved [RESOLVED] WCF Service with callbacks

    Hello,

    I have used WCF services before, but this is the first time I am dealing with using callbacks to notify connected clients.

    The issue I am currently having is that I can get the clients to connect once and the callback writes to all open clients, but after I close them the service doesn't work. It throws the following exception:

    "The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state."

    I am using the following code to execute:

    Code:
    var service = new service.serviceClient(new InstanceContext(new MessageCallback()));
                
    
    service.Open();
    
    service.SendMessage(new service.Message() { Message=service.Commands.Start, Parameters = null });
    
    Console.ReadLine();
    service.Close();
    Like I said, it executes fine the first time but it throws the error after that. I have tried using "service.Abort()" but that didn't make a difference as well as trying to check to the error, but it still throws.

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2010
    Posts
    259

    Re: WCF Service with callbacks

    Ok, so the issue was that I was trying to alter the list of clients while I was enumerating it. Go figure I didn't look at that part at all.

    Good thing traces exist.

Posting Permissions

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



Click Here to Expand Forum to Full Width