Comments (10)
Hi Andrew, don't worry, you're not spamming at all. On the contrary, good catch about the error! I'll make the change now and will upload new version so that you can give it a try. Will let you know once it's done
from dotnetcore.windowsservice.
Awesome, glad we fixed it mate. Thanks for making this lib better! Spread the work and let me know if you need anything else ;)
from dotnetcore.windowsservice.
Hey mate. 2 things come to mind afk. Try to omit "." when calling the service. Second thing to try would be running cmd/powershell as administrator. If that doesn't help, give this a read #12 . Tou might find some good points there. If nothing helps, I'll get back to to u tomorrow ;-)
from dotnetcore.windowsservice.
Yeah tried both of this things with no luck, I have simplified my app down to this, and again working locally not on the server:
public static void Main(string[] args)
{
LogManager.Configuration = new XmlLoggingConfiguration(
Path.Combine(AppContext.BaseDirectory, "NLog.config"), true);
var logger = LogManager.GetCurrentClassLogger();
Console.WriteLine("I am outputing.");
ServiceRunner<MyWindowsServiceApplicationService>.Run(config =>
{
config.SetName("MyWindowsServiceApplication");
var name = config.GetDefaultName();
config.Service(serviceConfig =>
{
serviceConfig.ServiceFactory(extraArguments => new MyWindowsServiceApplicationService());
Console.WriteLine("I am outputing.");
serviceConfig.OnStart((service, extraParams) =>
{
Console.WriteLine("I am not outputing.");
});
serviceConfig.OnStop(service =>
{
});
serviceConfig.OnError(e =>
{
Console.WriteLine(e);
logger.Error(e);
});
});
});
}
public class MyWindowsServiceApplicationService : IMicroService
{
public void Start()
{
}
public void Stop()
{
}
}
from dotnetcore.windowsservice.
I looks kinda similar to that issue I've send you previously. Try to get the int that the run method returns. It should be 0 if it works properly.
from dotnetcore.windowsservice.
Also get the app path this way : PlatformServices.Default.Application.ApplicationBasePath . That's what I use so it's worth trying.
from dotnetcore.windowsservice.
Updated the path (They seem to be reporting the same path.), the run method is returning a -1.
Ill read through the other ticket see if i can find what is causing my issue and report back. The annoying thing is that the only thing in the Start is Console.WriteLine and that is where the exception stack trace is ending.
Update: There is a lot to sift through in the other ticket but so far I have discovered:
- When I run it without
action:run
, I am getting all the correct output. - When I run with
action:run
through powershell I get the exception I mentioned, but I get it logged in nlog and the console from theOneError
callback. - When I manually run the service directly through the Services Window it just gets the same 1053 error and I don't get no log file with the error.
- When I manually run the service directly through the Services Window with File.WriteAllText no files are generated.
- I have the same sdk on the server and locally, I am running
dotnet publish
for getting the code up to the server. - This is what the path to the executable is setup as
C:\Program Files\dotnet\dotnet.exe C:\Program Files\My Windows Service\MyWindowsServiceApplication.dll action:run
Alright, thats all the information I have, sorry if I have been spamming you.
from dotnetcore.windowsservice.
Amazing what a good nights sleep can do, I figured it out in my nightmares. The problem is the path and the command that gets generated.
Locally the command thats getting setup for the service is C:\Program Files\dotnet\dotnet.exe C:\Projects\MyWindowsServiceApplication\MyWindowsServiceApplication\bin\Debug\netcoreapp1.1\MyWindowsServiceApplication.dll action:run
Notice no spaces to the DLL.
However on the server C:\Program Files\dotnet\dotnet.exe C:\Program Files\My Windows Service\MyWindowsServiceApplication.dll action:run
has spaces in Program Files
and My Windows Service
which is making them invalid.
Is there anyway to fix this, could we wrap the second parameter in quotes in the action:install
I am not sure if thats valid? From host = string.Format("{0} {1}", host, appPath);
to host = string.Format("{0} \"{1}\"", host, appPath);
:
from dotnetcore.windowsservice.
Ok that's done and uploaded in v1.0.17 Let me know if it helps ;)
from dotnetcore.windowsservice.
Just tested up on the server works perfect, thank you so much 👍
from dotnetcore.windowsservice.
Related Issues (20)
- Cross platform support? HOT 1
- Multiple timers HOT 1
- When starting the service, then immediately stopped too
- Service did not respond to the start or control request in a timely fashion HOT 10
- Cannot run this same service twice with different names HOT 1
- Service Recovery HOT 1
- service start timeout too short HOT 1
- How to change/remove default messages shown when starting project as a console app? HOT 1
- Can there be more than on Service HOT 2
- Message shown when service is installed is incorrect HOT 1
- Implement OnCustomCommand
- What has changed in 2.0.11? HOT 2
- cannot start service xxx on computer '.'
- Stopping and starting a service without admin rights HOT 1
- Target netstandard
- Question: How to use ExitCode?
- How to start service with a .Net Core 3.0 single file exe
- Can you support WEBSITE ?
- How to setup (start) service with Automatic(Delayed start) with .net core 3.0
- at DasMulli.Win32.ServiceUtils.ServiceHandle.Start() at DasMulli.Win32.ServiceUtils.Win32ServiceManager.CreateService(String serviceName, String displayName, String description, String binaryPath, Win32ServiceCredentials credentials, Boolean autoStart, Boolean startImmediately, ErrorSeverity errorSeverity) at PeterKottas.DotNetCore.WindowsService.ServiceRunner`1.Install(HostConfiguration`1 config, ServiceController sc, Int32 counter) at PeterKottas.DotNetCore.WindowsService.ServiceRunner`1.UsingServiceController(HostConfiguration`1 config, Action`2 action) at PeterKottas.DotNetCore.WindowsService.ServiceRunner`1.Run(Action`1 runAction) The service did not respond to the start or control request in a timely fashion
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dotnetcore.windowsservice.