Open pmunshi007 opened 5 years ago
I am having same error with the latest version also 2.0.9 version of PeterKottas.DotNetCore.WindowsService library.
I have this trouble too
upd
solution
I rewrote Main
method, replaced all slowly reflection
before
ServiceRunner<SomeService>.Run(config =>{
Quite a common problem. My solution was to implement an own descendant of MicroService class where I've started a RunOnceTimer with all the initialization, IoC with assembly scanning, Akka, Nancy in a callback method. Not before or during Run(). Basically, you start a separate thread (like timer) and immediately tell Windows you're all done loading.
Im having this problem too. @Apostol59 could you elaborate on your solution?
@kalimist123, no problem, bro.
I had di container configuration in method main
, container cofiguration was be relocated in OnStart
.
Main
method must contains minimum of operations before OnStart
.
//from example
void Main()
{
//old di configuration
ServiceRunner<ExampleService>.Run(config =>
{
var name = config.GetDefaultName();
config.Service(serviceConfig =>
{
serviceConfig.ServiceFactory((extraArguments, microServiceController) =>
{
return new ExampleService();
});
serviceConfig.OnStart((service, extraArguments) =>
{
//now di configuration
Console.WriteLine("Service {0} started", name);
service.Start();
});
...
}
}
@Apostol59 thank you
I was running into this error as well, however I was hitting it immediately when starting the service, it wasn't waiting 30 seconds. The issue was that I was using Network Service instead of Local System to run the windows service, must have been some sort of permissions issue...
@Apostol59
I am having same error with the latest version of PeterKottas.DotNetCore.WindowsService library. Above your solution didn't work for me
can you please help me..
@sagar-patel-sls Hi, I'm not a maintainer. May be @PeterKottas can help you, but, will be need more details, I think)
Hii @PeterKottas
I am having same error with the latest version of PeterKottas.DotNetCore.WindowsService library. Above your solution didn't work for me
can you please help me..
I know this issue was raised before but currently I am also facing the same issue and I have tried all the solutions provided in #13 but no luck. Most annoying part here is the code base is same in master branch and my current branch. I just added few arguments to pass while running the program however the code to install/start/stop/uninstall service is the same. I am able to install and run service from master branch code base. But I am getting below error while trying to start service via command-line in my current branch. I am running this program in administrator terminal and also my basedirectory path does not contain space.
Even If I try to run the installed process from user interface it gives me below error.
I am using 2.0.8 version of PeterKottas.DotNetCore.WindowsService library. What could be the reason here?