Comments (11)
Same issue. I used "New-Service -Name MyServiceName -BinaryPathName "C:\Users\Ramazan\source\repos\AlertMailWindows
ServiceonCoreConsole\run.bat action:run" -StartupType Automatic" to install service.(There is only "dotnet run" command inside batch file )I am dealing with a database that will check the parameters and notify somebody via e mail. I wrote classes and make a base class. I called baseclass inside Start method and used a timer(to check database every 30 sec. ). Also ı used " Microsoft.Extensions.Logging" nuget package.
from dotnetcore.windowsservice.
So how your CustomAction look like and the InstallExecuteSequence?
Is it possible to use 'dotnet run action:install' directly in ExeCommand? And how do unistall service before uninstalling (CustomAction in WIX). After building project I have *.exe file. Do you have it too?
from dotnetcore.windowsservice.
I finally get it worked. First of all install peter's repo. There is an example project there. It worked fine in my computer so the problem was on my project.
The steps ı followed:
1-) There was a class inside peter's repo. And there was timer so ı needed that class ı just modify it for myself,
2-)Open CMD and type: dotnet yourdll.dll action:run ı get an error that saying "The service process could not connect to the service controller" . Dont lose hope :D
3-) Then ı typed dotnet YourDll.dll action:install
Now ı ll try my service and let you know if it is working
from dotnetcore.windowsservice.
It didn't work as ı expected :( Probably the problem is inside my codes.
from dotnetcore.windowsservice.
Remember to put everything in thread/timer etc. OnStart has to be finished quickly :)
from dotnetcore.windowsservice.
I think ı put. I logged information to text files. ı used a locker object for not crash threads,(timer set as 1 sec and my operation takes 5 sec). While you are saying thread/timer you mean tasks? I didn't used tasks structer in my project. My project have 3 stage after get inside ElapsedEventArgs class
1-)Get a list from SQL datatable where parameters false.
2-) get that parameters ID and send notification via email.
3-) update paramaters to true.
from dotnetcore.windowsservice.
Guys please follow the docs in the readme. You should never use New-Service -Name, if you could there would be no need for this lib. dotnet YourDll.dll action:install is indeed the right way. Start simple to make sure the lib is working. Then add more things. Make sure you run as admin. The timer service should indeed be good starting point for you judging by your requirements.
from dotnetcore.windowsservice.
I think ı put. I logged information to text files. ı used a locker object for not crash threads,(timer set as 1 sec and my operation takes 5 sec). While you are saying thread/timer you mean tasks? I didn't used tasks structer in my project. My project have 3 stage after get inside ElapsedEventArgs class
1-)Get a list from SQL datatable where parameters false.
2-) get that parameters ID and send notification via email.
3-) update paramaters to true.
4-)Repeat that sequence every 20 sec.
Everything was goin fine . Service get inside ElapsedEventArgs class. But while it is counting the false paramater inside sql table it is doing nothing. I am confirmed that with a textfile. It cant pass that line.
from dotnetcore.windowsservice.
Peter, after correcting my source codes of service, I resolved the problem with WIX installer in a bit different way (I did it before your answer).
In VS2017 as a result of compilation of Console Appliaction (let's say "TestApp") I get "TestApp.exe" file and "TestApp.dll". I don't know why there is also an exe file but in WIX installer I use two CustomAction's:
- one to install service after installing files as: "TestApp.exe action:install name:'TestService'"
- second one to uninstall service just before uninstalling files as: "TestApp.exe action:uninstall name:'TestService'".
It seems to work now. Do you see any dangers? Maybe I shouldn't get and use *.exe application (I don't know why it is generated and it isn't in your example...) in this way to install and uninstall the service.
Please give me your opinion.
Thanks in advance.
from dotnetcore.windowsservice.
@Patryx You probably get the exe because of dotnet publish configuration as release and runtime being win64.
The only "danger" with this way of doing is that the wix installer doesn't support it and handle the responses properly. For instance, my bootstrapper installs .Net Framework 4.6.2 on an older system, but the registry isn't updated until after a system is restarted. The "action:install" sends the installer an error code because of the just mentioned state of the .net framework, but the self contained genius of dotnet actually runs successfully, installing the service but tells the user differently.
from dotnetcore.windowsservice.
Good job again! Glad we have a wix expert in da house as it seems people are using 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.