PC Review


Reply
Thread Tools Rate Thread

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

 
 
Guest
Posts: n/a
 
      15th Mar 2004
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?


 
Reply With Quote
 
 
 
 
Ignacio Machin \( .NET/ C# MVP \)
Guest
Posts: n/a
 
      15th Mar 2004
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,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

<(E-Mail Removed)> wrote in message
news:%23Ae$(E-Mail Removed)...
> 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?
>
>



 
Reply With Quote
 
Guest
Posts: n/a
 
      15th Mar 2004
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

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:#(E-Mail Removed)...
> 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,
>
> --
> Ignacio Machin,
> ignacio.machin AT dot.state.fl.us
> Florida Department Of Transportation
>
> <(E-Mail Removed)> wrote in message
> news:%23Ae$(E-Mail Removed)...
> > 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?
> >
> >

>
>



 
Reply With Quote
 
Ignacio Machin \( .NET/ C# MVP \)
Guest
Posts: n/a
 
      15th Mar 2004
Hi

Can you post some code?
Of the init.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
> "Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us>

wrote
> in message news:#(E-Mail Removed)...
> > 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,
> >
> > --
> > Ignacio Machin,
> > ignacio.machin AT dot.state.fl.us
> > Florida Department Of Transportation
> >
> > <(E-Mail Removed)> wrote in message
> > news:%23Ae$(E-Mail Removed)...
> > > 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?
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Schedule the call of a Web Service method: task scheduler or Windows Service? BLUE Microsoft C# .NET 3 3rd Jun 2007 09:22 PM
Calling a method from a Web Service Steven Blair Microsoft C# .NET 2 9th Feb 2005 01:37 PM
Calling a method in a object running in windows service =?Utf-8?B?SmFzbGVlbg==?= Microsoft C# .NET 1 9th Dec 2004 08:19 PM
calling a static method in a windows service? KK Microsoft Dot NET Framework 6 20th Apr 2004 04:46 PM
calling a static method in a windows service? KK Microsoft Dot NET 0 14th Apr 2004 08:09 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:24 PM.