Re: Windows Services

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Ken Cox [Microsoft MVP] (BANSPAMken_cox_at_sympatico.ca)
Date: 01/26/05


Date: Tue, 25 Jan 2005 19:16:06 -0500

That's off topic for an ASP.NET newsgroup but I'd look at the permissions
for the account that is running the batch file when you aren't.

It probably isn't allowed to interact with the desktop or something. Better
to take this issue to microsoft.public.dotnet.framework.component_services .

"mp" <john88m@hotmail.com> wrote in message
news:ObfHwJzAFHA.3708@TK2MSFTNGP14.phx.gbl...
>I start a service and I have the following code:
>
> //This code is Service2
> if(Directory.Exists(pathFinal) && Directory.Exists(PathIntermediate))
>
> {
>
> m_threadFinal = new Thread(new System.Threading.ThreadStart(BuildFile));
>
> m_threadFinal.Start();
>
>
> }
>
>
>
> private void BuildFile()
>
> {
>
> //all code works here
>
> //Then when I am done I want to stop my service and restart another
> service
>
> DoThe magic();
>
> }
>
>
>
> Private void DoTheMagic()
>
> {
>
> //want to stop service2 itself and restart service1
>
> try
>
> {
>
>
>
> ServiceController scStop = new ServiceController("service2");
>
> ServiceRunning=false;
>
> scStop.Stop();
>
> scStop.Close();
>
> ServiceController sc1 = new ServiceController("service1");
>
> if (sc1.Status.Equals(ServiceControllerStatus.Stopped))
>
> {
>
> sc1.Start();
>
> }
>
> }
>
> catch(Exception ex)
>
> {
>
> System.Diagnostics.EventLog.WriteEntry("error" + ex.Message ,
> System.Diagnostics.EventLogEntryType.Error);
>
> }
>
> }
>
> I do a Net Stop "service1" which works fine
> then I do a Net Start "service2" , actually these are in bat files.
> This works if i set schedule and run them manually , but If i wait for it
> to
> run the next day, service2 does not stop!!!!!!!!!!!!!!! so weired!!!! can
> anyone help???
>
> Thanks
>
>



Relevant Pages

  • Re: Admin problems not letting me play BIA, Halo, Far Cry?
    ... So I'll clutter the forums with this. ... I ran the batch file and sat back and waited ... I reinstalled the gameI am having permissions problems ... it's the default administrator/single user account. ...
    (microsoft.public.windowsxp.games)
  • Re: Admin problems not letting me play BIA, Halo, Far Cry?
    ... Jimmy, Thanks again for bearing with me here. ... all permissions to these accounts ... ... only Admin account, it didn't launch from there either. ... I ran the batch file and sat back and waited ...
    (microsoft.public.windowsxp.games)
  • Re: Admin problems not letting me play BIA, Halo, Far Cry?
    ... or creating a new Admin account would have resolved the issue. ... MS Games Help and Support Center: http://support.microsoft.com/?pr=gms ... | all permissions to these accounts ... ... I ran the batch file and sat back and waited ...
    (microsoft.public.windowsxp.games)
  • Re: Security- access to Event Viewer- SOS
    ... impersonate as an account with local administrative rights and does IISRESET ... > private void InitializeComponent() ... > public static void LogEventViewer(string ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Security- access to Event Viewer- SOS
    ... which the ASPNET account cannot do (If we set ... > private void InitializeComponent() ... > public static void LogEventViewer(string ... > Domain, string Password) ...
    (microsoft.public.dotnet.framework.aspnet)