windows-services

Windows service - how to make name configurable

一笑奈何 提交于 2019-12-12 07:56:39
问题 I have written a windows service in C#. The requirement at the beginning was that I should be running only one instance of that service, but that has changed and now I need multiple instances. This is why I need to change the service name according to the configuration file. What would be the best way to make it register with the correct name ? Should I write another tool to do it? Can I just read the name from App.config file and set it in the service and installer classes accordingly ? PS>

WebApp.Start<TStartup> Method Type Parameter

五迷三道 提交于 2019-12-12 07:45:38
问题 In setting up my Windows Service application to self host using Owin based on this article: http://www.asp.net/web-api/overview/hosting-aspnet-web-api/use-owin-to-self-host-web-api I used this overload of the WebApp.Start method: WebApp.Start Method (String) Here is my code: //(in startup method) _server = WebApp.Start<Startup>(BaseAddress); public class Startup { // This code configures Web API. The Startup class is specified as a type // parameter in the WebApp.Start method. public void

Update ASP.Net membership from windows service

跟風遠走 提交于 2019-12-12 07:28:35
问题 I am working on a project for a property management company. There is the back end system that stores all of the tenants and property portfolios, and a front end website that allows users to view their packages, service requests etc. I need to write a windows service that pulls their information out of the back end and place it into the membership database. I cannot figure out how to configure the service to connect to the membership provider. 回答1: You can basically use it as you were with

Remote controlling of windows service installed on intranet machine

北战南征 提交于 2019-12-12 07:27:06
问题 I have web application deployed on my local IIS 7, with application pool configured to work under built-in NETWORK SERVICE account. From this web application I need to check the status of my windows service (if it is started, stopped, etc). I've used such statements to get it: public string GetServiceStatus(string machine, string service) { var service = new ServiceController(machine, service); service.Refresh(); return service.Status; } The machine is an IP address of the host in my intranet

Stop program when thread finished [duplicate]

丶灬走出姿态 提交于 2019-12-12 06:56:54
问题 This question already has answers here : How to wait for thread to finish with .NET? (9 answers) Closed 5 years ago . I'm a newbie in C#. I have a windows service. In this service, I run a thread. I want to stop the service immediately after the thread finish. Currently, my code is like: while(true){ if(isThreadFinished){ MyService.Stop(); break; } } It work, but I feel that using while(true) like that is a stupid way. So, I want to know if there is any other way to achieve my request. 回答1:

Windows services with Python and py2exe

孤街醉人 提交于 2019-12-12 05:58:15
问题 I need some help with converting a python windows service using py2exe. Let me explain the problem. I have a python service, which works, no problems here. I used py2exe to turn it into an executable file. I tested it by replacing the python version of the service with this one and it works with no problems too. But when I move the exe version of the service to another computer, it will register with the service manager but won't start with the error: "The system cannot find the file

Run Batch-Files in Windows Service while logged off

♀尐吖头ヾ 提交于 2019-12-12 05:25:39
问题 I wrote a windows service in C# .NET 3.5. It starts up automatically and runs as Local System User (no log in required). If i run a Shutdown-Batch-File (shutdown -s -t 30) with my service by calling Process.Start(), nothing happens until i log in to windows. So it waits for logging in and then starts the batch. Is it possible to run this batch in logged off state? Greetings 回答1: There is a property for each service application called Allow Interact With Desktop that should be set True for

How to use SetClipboardViewer Function in Windows Service C#?

自闭症网瘾萝莉.ら 提交于 2019-12-12 05:15:17
问题 I am trying to get clipboard events using SetClipboardViewer. It works in a windows form when i override the function: protected override void WndProc(ref Message m) that belongs to the base class System.Windows.Forms. The problem is that i want to do it in a windows service. Does someone knows how to get the clipboard events in a windows service? Thanks. 回答1: Clipboard belongs to the session (actually the session's winstation), and there's no interactive user to do a clipboard copy in a

Processing messages fast from MSMQ in parallel from Windows Services

扶醉桌前 提交于 2019-12-12 04:57:18
问题 Our service run continuously 24/7 in a company, which retreives messages from MSMQ and after processing write result in DB. What we observe that our criteria of working with MSMQ is so old, and doesn't process many messages at a time, we need to process at least 200 or 250 transaction per second in a process, but what we uses only process 10 to 14 transaction in a second. implementation Of our Code is while (true)//(count < 2) { response = ""; try { rcvMsg = MQ.Receive(new TimeSpan(0, 0,

How to reinstall Windows Service using installutil after making changes in code

不想你离开。 提交于 2019-12-12 04:36:39
问题 I wrote a test Windows service and installed it using installutil which went fine. After that I made changes in my code and tried to install again but got error. Do I need to remove the service first, then install again using installutil? Or is there other way? 回答1: If the name of executable is the same then you can simply stop the Windows service, copy new files on top of the old ones and start the service. 来源: https://stackoverflow.com/questions/26561524/how-to-reinstall-windows-service