error updating windows serviceSolved

Hello, We receive this error message when trying to update an windows service:Exception: Cannot stop XXXX service on computer '.'.InnerException: The pipe has been ended Could you please help us?

Hey mihaimarin,

Does you service allow "Stop" commands? That is, when you're installing the service do you allow "SERVICE_ACCEPT_STOP" (if you install in c++) or "CanStop = true;" (if you install in C#).

Open the "Services" management console in Windows. Can you stop the service from there?

Hello, Yes, I can stop the service.

the error appears in InstallUpdate.Processes.cs -> srvc.Stop(); [line 45]

Ok, since you have a copy of the wyUpdate source -- after the exception is thrown (but before the update is rolled-back) is the service stopped? That is, is your service stopping but just not in a way that's "valid"?

If i attach the debugger, the status of the service (status = srvc.Status;) is Stopped.But, if I run without the debugger, I'm very sure that the status is running. It might me another thread that kills my service between status check and stop command.

I modified the code like this:try{ srvc.Stop();}catch (Exception ex){ throw new Exception("exceptie test:" + ex.Message+"\n"+ex.InnerException.Message, ex);}The output is: exceptie test:Cannot stop XXX service on computer '.'.The pipe has been ended

In the EV, the only information is The XXX service terminated unexpectedly. It has done this 22 time(s). 🙂

Are you adding the same "stop service" update action multiple times in your update?

Just once on each version (one stop and one start foreach version)

Are your other services shutting down this service? Any chance you can send me a link to your app (you can send it to support@wyday.com )

If helps you, I have the udpate type set on "DoNothing".I have the following workflow:0. Initialize AutomaticUpdaterBackend1. ForceCheckForUpdate2. on UpdateAvailable event I ask the user if he wants to update the service.3. If yes, I call InstallNow() and in the event ReadyToBeInstalled I call again InstallNow.

Are your other services shutting down this service? Any chance you can send me a link to your app (you can send it to support@wyday.com )

This is the only service involved in the system.No, sorry but I can't 🙁

I can't reproduce this behavior. Your service isn't shutting down cleanly, hence the exception being thrown. If you could reproduce this behavior on a test service, or if I could see a copy of your app, I could help fix this.

Try replacing the following line:

srvc.Stop();

with:

try{    srvc.Stop();}catch (Exception){    srvc.Refresh();    if (srvc.Status != ServiceControllerStatus.Stopped)        throw;}

Tell me if this works.

Edit: fixed the code to get the latest status of the service.

no, same error. I don't understand....Could be a problem calling twice InstallNow method? (first for download+extract and second for install)

No, the way you're using it sounds right. Did you try the edited code? I added a "srvc.Refresh();" statement to get the latest status of the service.

Yes, with the refresh added is working. But why do I not see this modification like a fix? 🙂

But why do I not see this modification like a fix?

There's something in your service code which is not shutting down correctly. I can't tell you what without seeing the code. I haven't been able to reproduce it here.

At any rate we'll add this change to wyUpdate and release 2.6.11.3. It should be out later today or early tomorrow.

Are you using the AutomaticUpdaterBackend from your service? If so, this is a race-condition problem.

Can you try updating again, but this time just run wyUpdate.exe (the unmodified version of wyUpdate). That is, don't update via the AutomaticUpdater. I'm thinking this might be a race condition where your service has already started to be shutdown by the AutomaticUpdater, when wyUpdate tells your service to shutdown again.

If you don't get an error when updating by just running wyUpdate.exe then this problem is probably a race condition.

Using just the wyUpdate (original version) everything is OK. With the automaticupdater i have problems (some times) with the start of the service too. But, using the wyUpdate the service is updating as it should.

Ok, this is probably a race condition. We're fixing this right now. After we've run it through our test we'll post a link for you to test it out. It will be up in about 20 minutes.

OK, I will wait for the update. Thank you.

Ok, try this version of wyUpdate: (link removed, get wyBuild 2.6.11.3 or above). When you run with the AutomaticUpdater everything should update smoothly.

Tell me if it works for you.

Seems to work with this version. But, after 10-20 repetitive updates I run out with unable to start service...something was wrong with the exe itself. I was forced to rewrite the exe in order to work. Anyway, this seems to be a better version...for my application 🙂

Great. We'll release 2.6.11.3 in about a day, then.

We've found a couple more bugs in the threading code in wyUpdate that might be causing failures you're seeing when you use the AutomaticUpdaterBackend. We're fixing these and we'll have the new release out either by the end of today (Monday) or tomorrow.

Sorry for the trouble.

wyBuild 2.6.11.3 is now out. Included is the fixed wyUpdate 2.6.11.3 which fixes the service race condition along with several other threading bugs.

No, this is not solved 🙂 I have the same problem with the new release.

Which error? the "Exception: Cannot stop XXXX service on computer '.'. InnerException: The pipe has been ended" or another error (e.g. "after 10-20 repetitive updates I run out with unable to start service")? Are you using the latest version of wyUpdate (included with wyBuild 2.6.11.3) or the other version I built you?

Is there any chance you can reproduce this on a smaller scale? That is, can you make an example service that reproduce this behavior? Or maybe we can arrange a time when we can do a virtual connection where I can see your development machine and see where the problem is.

Hello, I am sorry but it was an internal problem this time. Sorry for that. Your update component is working properly. Have a nice day.