windows-services

C# app hangs randomly when called from Process.Start()

荒凉一梦 提交于 2019-12-03 16:51:33
I have a Windows service set up to manage custom .Net tasks. Organization is: -Windows Service monitors a schedule and starts a worker .exe as needed. -Worker .exe (lightweight winform app) uses a command line argument to pull up a DLL (plugin) and run some code. This has been working well for months. I recently migrated it to Server 2012 (from 2008 IIRC) - this may be unrelated but it's hard to tell. Since some time after the migration, I've encountered an issue where the worker .exe "starts" after being called by a process.start(), but doesn't reach my code. No errors or anything, it just

Credential storage best practices

余生长醉 提交于 2019-12-03 16:35:58
I'm writing a Windows service and need to make authenticated web requests. The service will not be running under the ownership of the credentials used to make the request; this implies that I need to store the credentials for the request in some way. What are the best practices here? The credentials will need to be stored in App.config (or an analog); I'd rather not have the password hanging out in plain text. As passwords change frequently, building or otherwise baking in the password to the binary is not an option. The same question applies for Powershell. I need to make authenticated

Timer within Thread within Windows Service

狂风中的少年 提交于 2019-12-03 16:13:56
I cant figure out how to proceed the best way with this problem. Right now I have a windows service which only task is to gather data from a database with a specific DSN and then send out an email if the data is valid. The service contains a timer which ticks every 5 minuts and performs the tasks above. Now I need to re-write the windows service to be able to run on more than 1 DSN. I was thinking of making several threads inside the windows service and then again have a seperat timer inside each thread. Is this a good idea and how can this be done? I want to avoid having a windows service for

Windows service can't copy to file share

半城伤御伤魂 提交于 2019-12-03 16:05:00
I have a windows service set to copy files from a local directory to a samba share. The service connects via a UNC path to the server (i.e. \remoteserver\shareddir). I have logged in as the user under which the service is running, and was able to both copy files and create files on the samba share, using the UNC path. However, when running the service I am getting io exceptions that suggest a login error. I have run process monitor on that box, watching the service and I can see it finding the UNC path but getting a login error when trying to write to the share. This is using plain vanilla

Windows Service : error 5 :Access Denied

十年热恋 提交于 2019-12-03 15:44:48
I am trying to create a simple Windows Service. The User Account for the service is NetworkService . Then I ran installUtil from command prompt and I got this : The Commit phase completed successfully. The transacted install has completed. which means the service got installed successfully. But when I try to run it from the Service applet i get this error : Windows cannot the CustomersService service on Local Computer. Error 5 : Access is denied. I am using 64bit Windows 7. Vaibhav Singh I am not sure if you've already got this resolved though, the following helped me fix this on my system:

Auto-update a Windows Service [closed]

给你一囗甜甜゛ 提交于 2019-12-03 15:44:09
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed last year . I am about to develop a program which will be installed and run as a Windows Service on the back-end servers (with internet access) of several clients. I do not have physical access to the servers. What I am working on is a scheme for reliably rolling out updates to the program

Creating an MSI installer for a Windows Service

孤人 提交于 2019-12-03 15:06:25
问题 I have a Windows Service project in Visual Studio 2008. I've also added the setup and deployment project. Unfortunately, when I install it, the service does not show up in the services MMC snapin. I have already added the ProjectInstaller to the service project, and I've followed the instructions here already. 回答1: What you're looking for (and that article has nothing on this, that I can see) is a ProjectInstaller class. If you open your service up in design view, you can right-click and

Gracefully terminate WCF Service - complete all open sessions and restrict new sessions

十年热恋 提交于 2019-12-03 14:16:52
I have a WCF Service that I have written, which is hosted within a Windows service. It is operating in PerSession mode. The service permits clients to open files, make changes to files and close files remotely through the service. So far all works very smoothly. When the Windows service is stopped, I would like to be able have the WCF Service not accept any new sessions and yet allow already connected clients to complete their current sessions and work (within a reasonable period/timeout). What would be the best way to accomplish this? Basically, calling ServiceHost.Close() will accomplish

From WindowsService how can I find currently logged in user from C#?

只谈情不闲聊 提交于 2019-12-03 14:09:04
问题 I am running windows service under Administrator account and I would like to find out who is the currently logged in user. It will be different from account WindowService is currently running under. Is there any easy way to get it from c#? It is not: System.Security.Principal.WindowsIdentity.GetCurrent() neither System.Environment.UserName thanks edit I am interested who is currently logged in with Console session. thanks jadarnel27 I am not interested in other remote sessions since this is

Creating Windows service without Visual Studio

断了今生、忘了曾经 提交于 2019-12-03 13:56:53
问题 So creating a Windows service using Visual Studio is fairly trivial. My question goes a bit deeper as to what actually makes an executable installable as a service & how to write a service as a straight C application. I couldn't find a lot of references on this, but I'm presuming there has to be some interface I can implement so my .exe can be installed as a service. 回答1: Setting up your executable as a service is part of it, but realistically it's usually handled by whatever installation