windows-services

.NET Windows Services stopping order when the system shutdown

让人想犯罪 __ 提交于 2019-12-24 12:51:15
问题 I'm creating a windows service that is supposed to send a request to a RESTFull service that is located on the same machine when the system shutdown. I want to make sure that my service OnStop() event will fire before the IIS service is stopped. Is there a way that I can control the order of services closure? 回答1: Microsoft documents this: To set the shutdown order of services manually, create a multistring registry value that contains the service names in the order in which they should be

wcf upload/download large files (i.e. Img, mp3) in chunks with windows service

丶灬走出姿态 提交于 2019-12-24 12:09:56
问题 I have a window service and i want it to be able to upload/download large (around 4MB) files (Img, music etc.) in chunks. I tried to do that by changing the 'maxBufferSize' 'maxRecivedMessageSize' etc. in both the service and client app.config files, but unfortunately it didn't work. My question is how I can upload/download files in chunks. and if I can do that just with the App.config file? Thank! 回答1: WCF doesn't have direct support for chunking (it always sends whole data as single chunk)

wcf upload/download large files (i.e. Img, mp3) in chunks with windows service

血红的双手。 提交于 2019-12-24 12:07:01
问题 I have a window service and i want it to be able to upload/download large (around 4MB) files (Img, music etc.) in chunks. I tried to do that by changing the 'maxBufferSize' 'maxRecivedMessageSize' etc. in both the service and client app.config files, but unfortunately it didn't work. My question is how I can upload/download files in chunks. and if I can do that just with the App.config file? Thank! 回答1: WCF doesn't have direct support for chunking (it always sends whole data as single chunk)

Windows Service C

被刻印的时光 ゝ 提交于 2019-12-24 11:01:22
问题 I have written a windows service in C but the lack of documentation on writing a service in this language means that I have a few things I need help with. I want to create a config file that the service reads to get a few settings/options. I'm wondering what the best way to do this is and how to do it. The service .exe will be installed along with other files/programs at a user-specified location. The first question I have is should I keep this config file in the same directory as the service

Offscreen rendering to a texture in a win32 service

南笙酒味 提交于 2019-12-24 10:47:05
问题 I'm trying to write a C++ windows service that can render to a texture. I've got the code working as a regular console app, but when run as a service wglGetProcAddress() returns NULL. Can anyone tell me if this is possible, and if so, what do I need to do to make OpenGL work inside a service process? Edit: I still haven't got this to work under Vista, but it does work under XP. 回答1: Services run in non-interactive desktops. These desktops do not connect to the physical display device of the

Nightly Update DB with Windows Service

两盒软妹~` 提交于 2019-12-24 09:59:59
问题 I am very new to the windows services. and am trying to create an application that will update the db nightly. i already have the code that works (for the update itself) but i can't figure out how to code it within the service. Protected Overrides Sub OnStart(ByVal args() As String) ' Add code here to start your service. This method should set things ' in motion so your service can do its work. Dim timerDelegate As New TimerCallback(UpdateDB) serviceTimer = New Timer(timerDelegate, Nothing, 0

Debugging a Windows Service and trying to see what it sees

為{幸葍}努か 提交于 2019-12-24 09:59:28
问题 We currently have an automated system that runs as a service for processing satellite images. This service maintains a configuration file, in the configuration file we apply certain scripts(python) to covnert the input satellite imagery into a more usable format. The scripts call the required applications, for the conversion proces. The scripts themselves are invoked by the service via the system("command") (its written in c/c++). (the service uses the same account as the user). We currently

How to detect an incoming USB device in windows Service on Windows XP machine?

↘锁芯ラ 提交于 2019-12-24 09:42:50
问题 I an trying to write a simple Windows Service that shall detect any incoming USB device and Launch a GUI application. WqlEventQuery query = new WqlEventQuery("SELECT * FROM Win32_VolumeChangeEvent WHERE EventType = 2"); watcher.EventArrived += watcher_EventArrived; watcher.Query = query; watcher.Start(); watcher.WaitForNextEvent(); This solution works well in Win 7 However, it fails in XP (I have XP SP3). I found another solution here http://www.codeproject.com/Articles/63878/Enumerate-and

Do I need to terminate Task in windows service in OnStop method?

我怕爱的太早我们不能终老 提交于 2019-12-24 09:18:52
问题 So I have a Windows Service And I started task in OnStart partial class AppServices : ServiceBase { private static readonly ILog Log = LogManager.GetCurrentClassLogger(); private Task _task; public AppServices() { InitializeComponent(); } protected override void OnStart(string[] args) { Log.Info("Service started"); _task = Task.Factory.StartNew(StartWork, TaskCreationOptions.LongRunning); } protected override void OnStop() { Log.Info("Service stopped"); } private void StartWork() { while(true

Pass parameters to InstallUtil from Powershell

你离开我真会死。 提交于 2019-12-24 08:59:52
问题 I am trying to install a windows service from Power-shell as follows. $sn = """" + $serviceName + " " + $exeName + """" C:\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe -i /ServiceName=[$sn] $exeFilePath I am getting the following exception. Microsoft (R) .NET Framework Installation utility Version 2.0.50727.3053 Copyright (c) Microsoft Corporation. All rights reserved. Exception occurred while initializing the installation: System.IO.FileNotFoundException: Could not load file or