Closed jersiovic closed 7 years ago
I didn't yet try to upgrade the sample project but yes i do plan to support it.
Great :)
So i just updated the test service to 1.1 (see the feature/aspnetcore-1-1-0-upgrade branch) and that passes smoke testing. (Just waiting for appveyor to update their images so i don't have to add a custom download build step) Do you maybe have a repro code for your error?
You could also run into an initialisation error with asp.net core 1.1 making your Start()
method throw. This currently makes the service report -1
/ 0xffffffff
to windows here.
I'm using your library to allow execute Orchard CMS as windows service. This is the branch where I'm using it https://github.com/OrchardCMS/Orchard2/tree/runAsAService .
The point is when I execute it in standalone mode it works properly despite Start code is very similar when it is run as a service instead of standalone. https://github.com/OrchardCMS/Orchard2/blob/runAsAService/src/Orchard.Cms.Web/OrchardCmsWin32Service.cs#L47
The start project is Orchard.Cms.Web
For building it you need to execute: ´build.cmd´ from root folder
For publishing it from \src\Orchard.Cms.Web folder dotnet publish --configuration Release --output c:\OrchardCMS
For running it fromc:\OrchardCMS\ folder dotnet orchard.cms.web.dll --register-service -urls http://localhos:5000
But if you prefer a simpler repro project tomorrow I will try to reproduce it in a more simple one.
So if i follow your exact instructions i get an exception because it is meant to be --urls
and not -url
(one dash):
The short switch '-urls' is not defined in the switch mappings.
at Microsoft.Extensions.Configuration.CommandLine.CommandLineConfigurationProvider.Load()
at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)
at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
at Orchard.Cms.Web.OrchardCmsWin32Service.Start(String[] startupArguments, ServiceStoppedCallback serviceStoppedCallback)
If i leave that out, it works for me.. (at least it starts, i didn't invest time to make the right node version work that was used by the build).
Oh my god!! I didn't noticed I made this typo Thank you!
Glad to hear your issue is resolved 😄
My learning from this is that maybe the additional parameters passed to --register-service
should be checked before registering them.. maybe the CommandLineConfigurationProvider
class from the Microsoft.Extensions.Configuration
can be used to perform basic validation (an invalid URL passed to --urls
will still fail. just like it will fail when the port is already in use).
Besides, you should consider updating the Microsoft.Extensions.Configuration
to 1.1.0
as well.
Hi, first of all many thanks for sharing this code. I've been using successfully your library for executing as a windows service a Net.Core 1.0.1 project. Problem is when I updated the project to Net.Core 1.1.0 I receive a weird error message when the app services starts: Error: 0xfffffffff 0xffffffff.
Maybe the reason is your library doesn't support Net.Core 1.1.0. If that is the reason, do you plan to support it?