views:

172

answers:

1

I am using VB.NET, 3.5 Framework.

I created a WCF Service running as a console application. It is doing event listening for my workflow engine.

The second application I am trying to do is a WinForm that can monitor the service and return me back the current states of the engine's workers.

I am able to connect to the service fine, and I verified that my service has values being set when I step through it... however when my monitor makes a call to the service, I am returning values as though it is not being run? (So default values, not current values)

Any ideas what is going wrong? My WFE is multi-threaded so I was wondering if I needed to make the service interface a singleton pattern, but before I do that I am not sure if I am missing something else that should be easy?

If I step through my monitor into the call to the service, it even jumps into my service's code, but again, the variables and objects are not showing their current state.

+2  A: 

You mention that second app is tasked to "monitor the service and return me back the current states of the engine's workers."

How does your service retain state? Typically, WCF services are per-call, available on activation only, and they're disposed once a request has been handled.

What is the state, and how is it preserved between calls? Are you using a singleton service instance? Or do you go grab the state from a persistant store like a database, when requested?

I'm not quite clear on what you're attempting to do here, really.

Marc

marc_s
I am not using a singleton service instance.. I am guessing that to be the problem. How can I force that?Hopefully this is more clear:- Console app running with event handling, events are fired on set basis (heartbeat). This is where I am running the WCF service interface (to the class that tracks the heartbeats)- Separate win form app is trying to communicate to the WCF service so that I can get a list of the current workers (the ones firing the events)I asked in a previous question the best way to do this model, and WCF was the option recommended. Should I use something else?
IPX Ares
no, but I guess you are trying to do something that's not really possible. In WCF, the service class instances are only "alive" for a short period of time - while they're servicing a request. Most of the time, they don't even exist, so I don't really know what you want to monitor here.Also - why monitor yourself? There are TONS of performance counters in WCF which can monitor just about anything you'd want to know! Use those - much easier!
marc_s
We are adding this to an admin program that can remotely monitor the states of all of our programs. So there is no way to pass the current state of the service back to the callers?
IPX Ares
What is the "state of the service"?? 99% of the time, there **IS** no service in memory! The whole management story for WCF is a bit annoying right now, it should get a lot better with the "Dublin" add-on for Windows Server, available sometime after .NET 4.0 / VS 2010, early in 2010 (hopefully)
marc_s
You're self-hosting - so you could probably find a way to interrogate the ServiceHost for some information - but mostly static info, like the configured endpoints and so on. But other than that - it's pretty much a black box
marc_s