Comments (14)
Ok. this is what i found out.. the service started working once i upgraded to .net core version 2.0 !!! To recap, even with .net core version 1.1, there was no difficulty in running the application stand-alone or as a service with a "local system" account. The service started to fail only when i configured it to run using a service account..
However, with the same service account and after upgrading my projects and libraries to core version 2.0, the service is working fine.. strange.!!
For your Ref: #45 (comment)
from dotnetcore.windowsservice.
@ragnarol @xVishera @kmcgain @andymac4182 @PeterKottas tagging folks hoping they can take a look at the issue..
I have this working with sc.exe using a standalone app. I am sure you could get the same working with New-Service
can you please share the script that worked for you.? were you able to specify a service account while installing the service using sc.exe.??
TIA.
from dotnetcore.windowsservice.
@gitfortee Remove "PlatformServices.Default.Application.ApplicationBasePath" from your path.combine and your application should write the logs.
After that, try installing the service just with "myservice.exe action:install"
from dotnetcore.windowsservice.
@xVishera I would also want to specify an user account for the service. when i use "myservice.exe action:install
" and specify a user name and password, it will appear on the 'Path to executable' property of the service. which i can't allow.
Meanwhile, removing "PlatformServices.Default.Application.ApplicationBasePath
" does not still write log files. I expect the files to be created under "C:\Apps\ServiceApp\logs
" which did not happen..
I guess will still need "PlatformServices.Default.Application.ApplicationBasePath
" such that the "logs
" folder is created in the path where the "ServiceApp.dll
" is present. ??
from dotnetcore.windowsservice.
Meanwhile, i tried using sc.exe but ending up in the same kind of issues. the script looks like below. I put these inside a batch file but the results are the same even when i tried to run each of the commands separately from the command prompt.
I made sure to run the command prompt as "Administrator". Also added the service account to the "Logon As Service
" rights.
sc.exe delete "ServiceApp"
sc.exe create "ServiceApp" binPath= "C:\Apps\ServiceApp\ServiceApp.Console.dll action:run" DisplayName= "ServiceApp" start= auto
sc.exe config "ServiceApp" obj= "domain\serviceaccount" password= "somepassword"
from dotnetcore.windowsservice.
@gitfortee If you run the .exe instead of installing, it works ?
from dotnetcore.windowsservice.
it works perfectly when :
I ran it with the command "dotnet ServiceApp.dll
"
Or when
I used a batch file with the command "dotnet ServiceApp.dll action:install
"
However.. I also need to specify a service account to use. At this time, I have to manually go to the servies.msc to change the Logon property of the service. Which is an overkill and more manual intervention every time i need to deploy a new version of the service.
I do not intend to expose the password by using "dotnet ServiceApp.dll action:install username:<> password:<>
". Since running this command exposes the password via the 'Path to executable
' property of the service.
from dotnetcore.windowsservice.
@xVishera this is how the "path to executable" looks like "C:\Program Files\dotnet\dotnet.exe "C:\Apps\ServiceApp\ServiceApp.dll" action:run
" when i used
C:\Apps\ServiceApp> dotnet ServiceApp.dll action:install
Notice that the action:run
is outside the double quotes.. is this still OK?
from dotnetcore.windowsservice.
I guess your comment on removing the "PlatformServices.Default.Application.ApplicationBasePath
" DO write the logs However I could not find useful information from the error log.
I also think to check if everything is OK with the service account that i am using. will keep you posted.
from dotnetcore.windowsservice.
@gitfortee It's hard to tell because I never needed to install this way, But I would give a try with
C:\Program Files\dotnet\dotnet.exe "C:\Apps\ServiceApp\ServiceApp.dll action:run""
Because "action:run is part of the command to ServiceApp.dll
from dotnetcore.windowsservice.
@ragnarol @xVishera @kmcgain @andymac4182 @PeterKottas
Folks, once again.. the issue still persists. there is no way for me to capture a global exception handler in order to get more details about the
Faulting module path: C:\windows\system32\KERNELBASE.dll
Exception code: 0xe0434352
looks like when i specify the service account, i am getting into this error. Meanwhile i check the service account, any help that you could provide is valuable.
thanks.
from dotnetcore.windowsservice.
hi @gitfortee
I install the services using the following powershell:
& dotnet $exe action:install name:$serviceName username:$username password:$password
And neither the username or the passowrd get exposed in the Path to Executable.
from dotnetcore.windowsservice.
@ragnarol thanks for the response.. do you suggest to create an .exe? meaning a self-contained exe.? at present i have a .dll as a framework dependent deployment. I can try creating an .exe and see how it proceeds.
Also, the $exe in your power shell command.. should it contain the absolute path to the .exe ? such as C:\ServiceApp\ServiceApp.exe ?
from dotnetcore.windowsservice.
Hi, sorry it's not an exe it is a dll. The powershell variable is called exe because I copy that bit from another project.
I run the script through octopus deploy so I understand that it runs it from the folder where the DLL is, so no need of using a full path for it.
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.