Windows services problem

  • Thread starter Thread starter Giox
  • Start date Start date
G

Giox

Hello everybody, I have problem using Windows Services.
I want to host a server application on in a windows service and I'm
not able to do that. In effect when I try to start the service I
receive an error that says something like that: "The ServerCrypto
service on the local computer has been started and then stopped. Some
services stop automatically if there aren't operation to execute, for
example ........ " (I hope this is correct I tried to translate the
italian message that I received). I'm not an expert of windows
services (in effect up to now I used the IIs to host remote server but
now I cannot do that:-( ) and so I'm not able to understand where can
be my error... the thing that I don't understand is why I receive the
same error message when I try the code proposed by Ingo Rammer in his
book.... do you have some indication?
 
Giox,

Chances are that an exception is being thrown somewhere and killing the
service process. You should probably set up some sort of catch (around your
entry point) for any exceptions and then log it to a file, and see what you
get.

Hope this helps.
 
Ok
I will try to do that, but can you confirm the following idea? is it
true that if I create a windows service that's working perfecly, it
cannot stop himself? I have this doubt watching at the win service of
Ingo Rammer (framework 1.0) that stops itself. May be this is a
compatibility issue between the frameworks?
Searching on google I got only few examples of remoting on windows
services and all of them are referred to framework 1.0 :-(
Thanks Giox
 
Giox,

I don't see why a service can't stop itself. I mean, you could just
exit the program, and it won't be running anymore. That doesn't mean that
it was a clean shutdown, but it definitely would have stopped if the program
terminated in some way.

As for a compatability issue between the frameworks, if you upgraded the
runtime from a previous version, then it shouldn't be ^THAT^ much of an
issue, but it definitely could be.
 
Sorry my English is orrible, in the previous mail my question was "is it
possible that automatically after a certain time interval the service stop
itself without any external instruction", because the error that I receive
seems to say that .... (in effect i wrote a different question I beg pardon)
For the framework I think that's not this the problem cause also the example
in the Advanced .net remoting has the same problem but in the websites I
didn't find any correction to this code.
Thanks again and sorry for my English :-)
 
Giox,

You could do that, but I would advise against it. Rather, I would just
make it do nothing during the periods of time that you don't want it to
operate.

What are you doing in the service? You mentioned remoting. What gives
you the idea that there is something in there that is causing the problem?
 
I think that there is something else that create me some kind of problems
cause testing the code as consolle application I have no problem and when I
try to implement it as service I try to follow the idea of MSDN.... but
tonight I will try to write some log, and if I will find some error I will
post another time new questions. Thanks a lot Nicholas
 
Giox,

What is the account that you are running the service under? If you are
exposing objects through remoting, and you have it run as the LocalSystem
account, then it should fail, because the account doesn't have network
access. Rather, have it run under the NetworkService account, and it should
have network rights.
 
Thanks, this is my principal error (but not the only one....)
Now it works!
Thanks a lot Giox
 
Back
Top