windows-services

IAsyncOperation await in Windows Service: “Type is defined in an assembly that is not referenced…”

久未见 提交于 2019-11-28 05:21:23
问题 I have a Windows Service (created using this tutorial). And I am trying to run an IAsyncOperation : var uri= new Uri(@"uri/to/second/app"); var options = new LauncherOptions { TargetApplicationPackageFamilyName = "second-app-guid" }; var results = await Launcher.LaunchUriForResultsAsync(uri, options); However, I get the following error from the await : The type 'IAsyncOperationWithProgress<,>' is defined in an assembly that is not referenced. You must add a reference to assembly 'Windows,

How can I monitor status changes of windows services under windows xp?

筅森魡賤 提交于 2019-11-28 05:18:33
问题 I'm trying to write a program in C, that can detect when some Windows services (aka. NT services) are started or stopped. There seems to be a function NotifyServiceStatusChange, but that's only available on Vista and Windows 7. I'm trying to do this on Win XP, so what's the best way? Is there any other than continuous polling? edit: Is anybody able to give answer in C? I'm also ok with C++, but I'd like to stay away from scripting. 回答1: Looks like the closest you can get in XP is

Windows Service runs but stops processing after two days

徘徊边缘 提交于 2019-11-28 05:18:27
问题 I've seen a fair few posts regarding this issue but non that seem to fit my criteria. Having said that, this is the first one that I've built that "needs" to perform a tremendous amount of logic. All works great for a couple days but after that logic stops working with no log in the event viewer nor firing of an email (exceptions). I'm wondering if my logic is not correct... Looking for advice and pointers. public partial class QuayService : ServiceBase { private System.Timers.Timer m

Install windows service without InstallUtil.exe

帅比萌擦擦* 提交于 2019-11-28 05:16:40
I'm trying to deploy a windows service but not quite sure how to do it right. I built it as a console app to start with, I've now turned it into a windows service project and just call my class from the OnStart method in the service. I now need to install this on a server which doesn't have Visual Studio on it, which if I've understood it correctly means I can't use the InstallUtil.exe and have to create an installer class instead. Is this correct? I did have a look at a previous question, Install a .NET windows service without InstallUtil.exe , but I just want to make sure I've understood it

Minimum rights required to run a windows service as a domain account [closed]

江枫思渺然 提交于 2019-11-28 04:53:13
Does anyone know what would be the minimum rights I would need to grant to a domain user account in order to run a windows service as that user? For simplicity, assume that the service does nothing over and above starting, stopping, and writing to the "Application" event log - i.e. no network access, no custom event logs etc. I know I could use the built in Service and NetworkService accounts, but it's possible that I may not be able to use these due to network policies in place. Two ways: Edit the properties of the service and set the Log On user. The appropriate right will be automatically

How to monitor Windows services [closed]

杀马特。学长 韩版系。学妹 提交于 2019-11-28 04:52:50
I'm looking for a way to monitor certain Windows services (on Windows Server 2003) and restart if necessar y. The services are on different servers and include mainly SQL Server services (e.g. SQL Server Agent), but also some proprietary services. Email alerts sent out if a service has stopped would be very useful as well. A "might be enough" version of this is built into Windows. Look into the "Recovery" tab of the service properties, as available via services.msc . You can act on a service fail with: "Restart the Service" "Run a Progam" "Restart the Computer" "Run a program" could be a small

Windows Service to run a function at specified time

余生颓废 提交于 2019-11-28 04:11:06
I wanted to start a Windows service to run a function everyday at specific time. What method i should consider to implement this? Timer or using threads? Settapon H (1) On first start, Set _timer.Interval to the amount of milliseconds between the service start and schedule time. This sample set schedule time to 7:00 a.m. as _scheduleTime = DateTime.Today.AddDays(1).AddHours(7); (2) On Timer_Elapsed, reset _timer.Interval to 24 hours (in milliseconds) if current interval is not 24 hours. System.Timers.Timer _timer; DateTime _scheduleTime; public WinService() { InitializeComponent(); _timer =

Multiple Windows Services in One exe

此生再无相见时 提交于 2019-11-28 04:09:59
I am trying to build several Windows services to do different things. For instance, I need Windows services that will: Send a daily report via email Periodically cleanup some archived info every 30 minutes etc. The tasks I need the windows services to do are distinct so I don't really like the idea of having them all in one service. What I've got so far is a project in Visual Studio 2008. I've created a windows service, I've set up a timer on the OnStart event (it just writes to a text file every 5 seconds for testing purposes). I then added an Installer to the project and when I run

Why doesn't the RequestAdditionalTime() method work on restart in Vista/7?

依然范特西╮ 提交于 2019-11-28 03:41:45
问题 I have been doing some extensive testing of a Windows Service I have been writing in C# .Net 3.5. I am having trouble getting Windows to give me enough time for my service to shutdown properly when I restart or shutdown the computer even though I am invoking the RequestAdditionalTime() method which should update the SCM and keep my service running. My code works properly if I manually stop the service however. I have primarily been testing this code in Windows Vista and Windows 7, upon

Windows service on Local Computer started and then stopped error

别来无恙 提交于 2019-11-28 03:37:36
Usually, I get this error: (The "service name" service on Local Computer started and then stopped. Some services stop automatically if they are not in use by other service or programs) when there's something wrong with my code, like non-existing drive paths, etc. The windows service will not start. I have a windows service that backs up folder/files, to a location if it reached the size limit. Details are all provide by an XML Configuration that the windows service reads on start. I have a separate windows forms that has a button that does exactly what my windows service's onstart is doing. I