windows-services

What's the best way to implement a scheduled job using a windows service

柔情痞子 提交于 2019-12-02 02:48:23
I have a database job that runs occasionally at night and I need a windows service to poll the database regularly to do some more work after the SQL job is done. I am a looking for a solid example to write a scheduler that can fail gracefully without crashing the service. Take a look at http://codeplex.com/TaskService Mark Ransom Just make it a scheduled task. See windows service vs scheduled task I would use MSMQ, add a final step to the job that adds a message to the queue (Via ActiveX Script / COM or a .net call if you can) Then have your service monitoring the Queue. As far as not crashing

Writing values to the registry with C#

被刻印的时光 ゝ 提交于 2019-12-02 02:39:20
I'm in the process of creating a C# application which will monitor changes made to the registry and write them back to the registry next time the user logs on. So far I've got it monitoring changes, reporting them, writing the hive, key and value to a text file. I'm now at the point where I need to take them values out of the file and place them back into the registry. Now I've looked at various tutorials but none have been able to answer the question/problem I have, so for example the registry key I wish to change is: HKEY_USERS\S-1-5-21-2055990625-1247778217-514451997-41655\Software

Powershell - Start Windows service with a parameter

萝らか妹 提交于 2019-12-02 01:53:50
I need to start a windows service via Powershell with a '1' as a parameter, like below: So basically I want to do something like this with powershell: Start-Service _MyService 1 <- won't work Googling has produced nothing of note on this, perhaps I'm looking for the wrong thing, but I can't believe it's not possible. Clues anyone? An alternative is to use the Get-Service cmdlet to obtain a service controller, and then invoke its Start() method. # "ServiceName" != "Display Name" $yourService = Get-Service "ServiceName" $yourService.Start(1) If you need to supply multiple arguments (credit to

Instrumenting windows service with Application Insights

↘锁芯ラ 提交于 2019-12-02 01:34:09
Is it possible to instrument a windows service running on premise with Application Insights? It's not necessary to have it automatically collecting metrics of the application like it does with Web applications, pushing custom events to Azure would suffice. Alan Wills -MSFT I'll make the docs a bit more clear on this. You can instrument anything if there's a core SDK that will build with it. So any kind of .NET, Java, PHP, OSX, iOS, Android, .... If you want additional modules that log web requests, crashes, etc, you're a little bit more restricted. For Windows Services on premises, follow what

VS2008 on Win7 64-Bit: Debugging a Windows Service

戏子无情 提交于 2019-12-02 01:33:50
问题 I'm trying to debug a Windows Service using VS2008 on Win7 64-Bit. The problem I'm having is that none of my breakpoints are being hit, regardless of which build configuration I choose: x86, x64 or AnyCPU. Using "Attach to Process" after the service has started, none of the breakpoints are hit - yet the IDE doesn't inform me that they won't be hit (by making the solid red circle and outline, for instance) - it simply seems to act as if the breakpoints weren't even there. Can anyone point me

Logstash-forwarder as Windows Service

末鹿安然 提交于 2019-12-02 01:29:16
I'm struggling to create a Windows Service for a logstash forwarder on Windows 2008 R2 Server. My setup looks as follows: Ubuntu Server 14.04 LTS Elasticsearch Logstash Kibana Windows Server 2008 R2: Application logging to a certain path. Ship logs to the ELK Stack via Logstash-forwarder I'm currently shipping logs successfully to the ELK-Stack via Logstash forwarder compiled for Windows using the instructions here... https://github.com/elastic/logstash-forwarder . The only problem is, that I have to run the logstash forwarder in a CLI window, and I'm not able to set it up as a Windows Service

Excel Automation Windows Service

断了今生、忘了曾经 提交于 2019-12-02 01:25:00
I have a Windows Service that runs the Excel Interop in order to automate the execution of various macros. However, I am running in a peculiar issue when I try to run a macro which access a database using Windows Authentication ... If the macro is run through the Windows Service , the workbook is opened and the macro is execution is started but the application hangs (presumably at the data access portion). If, however, the macro is run through the Visual Studio debugger , using the same implementation as the service (they call the same class library), it executes, saves the workbook, and

ServiceBase service error 193:0xc1 on Windows XP

蹲街弑〆低调 提交于 2019-12-02 01:13:27
I have a service that I've built using the C# ServiceBase class. It works when I run it in Windows 7 and Windows Server 2008; however, it doesn't work on Windows XP. I created the service using sc create PBUService binpath= "C:\PBULogger.exe" . This is the correct path. Nothing is logging in the Event Viewer under anything and my exception handling code doesn't fire either. I thought maybe I didn't have the correct .NET version installed, but I have 4.0 installed on the XP machine. However, I created this project using Visual Studio Express 2012, which I'm pretty sure uses .NET 4.5 by default.

WMI call takes too much time when system Starts/ReStarts

余生颓废 提交于 2019-12-02 00:13:56
I want to get the path of the Windows Service, var managementObjectSearcher = new ManagementObjectSearcher("Select * from Win32_Service where serviceName = MyService"); this code is written of the constructor of some other service... everything works fine when system is UP and running but if i restart the system put the StopWatch class for this call and it shows that it shows that the service takes 35-45 seconds to start because of this call.. Any suggestions to improve the performance on system restart... RRUZ The Windows32_Services class doesn't exist, so assuming which you are using the

run java application as background process

风格不统一 提交于 2019-12-02 00:13:52
i have made an application using java....when i am installing it on my computer ...i want it to run as background process instead of application...if any user try Task manager...then he can not found it in application....it should no listed in application list...it is there in process list.... so please tell me how can i do this ...as soon as possible....? My work uses this: http://wrapper.tanukisoftware.org/doc/english/download.jsp It works well for them and has a lot of functionality. Also take a look at http://yajsw.sourceforge.net/ . There is a comparison table for YAJSW , JSW , ACD and