windows-services

Should I host my WCF service in IIS?

和自甴很熟 提交于 2019-12-03 05:59:32
问题 So I'm designing a WCF service. I'm unexperienced with WCF, and I'm trying to decide whether it should be hosted in IIS, or a custom Windows service.. Or some other option? Things to consider: It needs to load data from a database on startup. It needs to maintain this data across requests, not load it each time. It needs to process multiple requests simultaneously. It needs to be as configurable as possible regarding endpoints. It will be calling native dlls quite a lot. I suspect hosting it

c# Granting “Log On As Service” permission to a windows user

只谈情不闲聊 提交于 2019-12-03 05:47:08
how do I grant a user the LogOnAsService right for a service? I need to do this manually, in the services.msc app I can go to the service, change the password (setting the same that there was before), click apply and I get a message: The account .\postgres has been granted the Log On As Service right. How do I do this from code, because otherwise I have to give this permission by hand each time I run the application and this is not a possibility @Steve static void Main() { // irrelevant stuff GrantLogonAsServiceRight("postgres"); // irrelevant stuff } private static void

How to make a Windows Service from .Net Core 2.1/2.2

我的梦境 提交于 2019-12-03 05:44:22
Recently I had a need to convert a .Net Core 2.1 or 2.2 console application into a Windows Service. As I didn't have a requirement to port this process to Linux, I could dispense with the multiple platform solutions that I had seen on Stackoverflow that dealt with any combination of .Net Framework, .Net Standard and .Net Core. A bit of digging and much help I had something that worked: In this post I will describe the steps required to set up a .Net Core 2.1 or 2.2 process as a Windows Service. As I have no requirement for Linux, I could look for a solution that was Windows-specific. A bit of

How to write an URI string in App.Config

ε祈祈猫儿з 提交于 2019-12-03 05:23:16
I am making a Windows Service . The Service has to donwload something every night, and therefor I want to place the URI in the App.Config in case I later need to change it. I want to write an URI in my App.Config. What makes it invalid and how should i approach this? <appSettings> <add key="fooUriString" value="https://foo.bar.baz/download/DownloadStream?id=5486cfb8c50c9f9a2c1bc43daf7ddeed&login=null&password=null"/> </appSettings> My errors: - Entity 'login' not defined - Expecting ';' - Entity 'password' not defined - Application Configuration file "App.config" is invalid. An error occurred

Thread Sleep and Windows Services

懵懂的女人 提交于 2019-12-03 05:19:43
问题 I'm working on a Windows Service that's having some issues with Thread.Sleep() so I figured I would try to use a timer instead as this question recommends: Using Thread.Sleep() in a Windows Service Thing is it's not entirely clear to me how one might implement this. I believe this is the way but I just wanted to make sure: '' Inside The Service Object Dim closingGate As System.Threading.AutoResetEvent Protected Overrides Sub OnStart(ByVal args() As String) Dim worker As New Threading.Thread

Start python .py as a service in windows

故事扮演 提交于 2019-12-03 05:18:09
问题 I've created a windows service to start a .py script. sc create "Maraschino" binPath= "C:\HTPC\Maraschino\maraschino-cherrypy.py" DisplayName= "Maraschino" depend= "Tcpip" Then I've added a registry key to link the .py to open using python.exe Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Maraschino\Parameters] "AppDirectory"="C:\\Python27" "Application"="C:\\Python27\\python.exe C:\\HTPC\\Maraschino\\maraschino-cherrypy.py" However when I try

Pros and Cons of running Quartz.NET embedded or as a windows service

独自空忆成欢 提交于 2019-12-03 05:06:56
问题 I want to add quartz scheduling to an ASP.NET application. It will be used to send queued up emails. What are the pros and cons of running quartz.net as windows service vs embedded. My main concern is how Quartz.NET in embedded mode handles variable number of worker processes in IIS. 回答1: Here are some things to you can consider while you decide whether you should run embedded or not: If you are going to be creating jobs ONLY from within the hosting application, then run embedded. Otherwise,

What is the most reliable way to create a custom event log and event source during the installation of a .Net Service

三世轮回 提交于 2019-12-03 04:50:38
问题 I am having difficulty reliably creating / removing event sources during the installation of my .Net Windows Service. Here is the code from my ProjectInstaller class: // Create Process Installer ServiceProcessInstaller spi = new ServiceProcessInstaller(); spi.Account = ServiceAccount.LocalSystem; // Create Service ServiceInstaller si = new ServiceInstaller(); si.ServiceName = Facade.GetServiceName(); si.Description = "Processes ..."; si.DisplayName = "Auto Checkout"; si.StartType =

Installing a Topshelf application as a Windows service

心不动则不痛 提交于 2019-12-03 04:42:51
问题 Using Visual Studio Express 2012, I've created a console application using Topshelf (Version 3.1.107.0). The application works as a console application, but I can't figure out how to install it as a service. I've published the project from within Visual Studio (Build, Publish), started a command prompt as Administrator, navigated to the folder where the application was published, and run setup.exe -install from the command prompt. The application is installed and runs, but as a console

What is the difference between a windows service and a regular application?

[亡魂溺海] 提交于 2019-12-03 04:37:30
I have only created regular windows applications (C# mostly). What differentiates a windows service from a regular windows application? What makes them different? What can a service do that an application can't? What are the differences seen from a developers point of view? How do you create one? Is it just to create a regular application (Console application maybe, since there are no gui?) and run or install it in a special way, or is it more that has to be done? There are a couple of things that jump out to me immediately. They run in an entirely different console starting with Vista As a