Calling a static method from within a C# windows service causes the service to hang?

G

Guest

Just encountered a bizzare issue that I hope someone can explain. We've
built a generic hosting service in C# (something like SVCHost) that calls a
logger class for logging purposes. The logger class has only static methods
(including a static constructor).
We registered the generic host as two seperate services, each running a
different set of classes. When we try to start both services the first one
starts fine, but the second one immediatly hangs on the first call to the
logger class and simply doesn't return. As for as we can tell this happens
only with services.

Any idea someone?
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

Each service will have a different AppDomain, meaning that each one will
have a different copy of the Logger class, maybe the problem is taht you are
initializating the class on one service and not in the other.

Cheers,
 
G

Guest

These are two separate Processes (looked in the task manager), so I would
assume each one will initialize it's own instance. Therefore I can't
understand why the second service hangs.

- Homer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top