windows-services

Set version on a windows service

核能气质少年 提交于 2019-12-06 11:20:39
I have a windows service that is installed using a setup project. Things work fine but I would like to be able to set the version of the service as I do with the AssemblyVersion of my assemblies. The only place where I have been able to see this version number is in the version column in the listing of applications in the add or remove applications dialogue. In the solution explorer highlight your setup project. Then select your "Properties" tab. (not right click the project, this is counter intuitive) Find version number at the bottom, when asked to change the product code, select yes. That

how to access romote windows service with Related ObjectQuery

岁酱吖の 提交于 2019-12-06 09:27:53
I want to control (start and stop) a windows service which is in the remote machine. I can connect that machine but I can't access to windows service. Here is my code. Can you help me? ConnectionOptions oConn = new ConnectionOptions(); oConn.Username = "****"; oConn.Password = "****"; ManagementScope managementScope = new ManagementScope(@"\\***.***.***.***\root\CIMV2", oConn); managementScope.Connect(); RelatedObjectQuery roq = new RelatedObjectQuery("Win32_Service.Name='KanAktarim'"); ManagementObjectSearcher moSearcher = new ManagementObjectSearcher(managementScope, roq);

How to install redistributable package of .NET Framework with Wix?

老子叫甜甜 提交于 2019-12-06 09:27:27
I have a general task: install .NET Framework 3.5 during the setup of my product. I do the following: I have created a custom action X Custom action X starts an executable Y via Process.Start() Executable Y kills the msiexec process and run .NET Framework setup package Here appear some problems: .NET Framework setup says that Windows Installer Service is not accessible and asks to terminate all another installations! I think, the cause of it is that Process.Kill() method terminate the process incorrect. When I kill the msiexec process via Kill() the msiserver service is NOT STOPPABLE, but if I

C# based Windows Service - Tries to do JIT Debugging in production

﹥>﹥吖頭↗ 提交于 2019-12-06 08:45:03
问题 I am getting this error in my event logs for a service I put into production: An unhandled win32 exception occurred in RivWorks.FeedHandler.exe [5496]. Just-In-Time debugging this exception failed with the following error: Debugger could not be started because no user is logged on. I have it installed and running under a Win NT global account. I have no idea why it is trying to drop into debugging mode. It was built under the Release model. Running on the 4.0 Framework. When I run on my dev

How do I return a value from a console application to a service in .NET?

本秂侑毒 提交于 2019-12-06 08:42:59
问题 I have a .NET service. I have a .NET console application. I want something along the lines of the service calling Process.Start("consoleapp.exe") and getting some information returned back from the app, ideally just returning a number. How do I do this? Edit: I figure it must be: Process.Start("myapp.exe").ExitCode - but how do I set the exit code in the console app? 回答1: Process p = Process.Start("app.exe"); p.WaitForExit(); int number = p.ExitCode; And in app.exe you set Enviroment.ExitCode

Query all Windows Services with JNA

牧云@^-^@ 提交于 2019-12-06 08:25:06
Currently I'm trying to query all installed Windows Services from (remote) machine. I had a look at win32.Advapi32 . But here I can only "get" a defined (I have to give a "ServiceName") Windows Services. (Advapi32.INSTANCE.OpenSCManager, Advapi32.INSTANCE.OpenService, Advapi32.INSTANCE.QueryServiceStatusEx) Do you know any API which allows to query all Windows Services from (remote) machine? EDIT:// I tried it allready with the following code. But it aborts hardly with no error message! public void getService(){ IntByReference size = new IntByReference(); IntByReference lppcbBytesneeded = new

CoCreateInstance does not start or connect to ATL COM service

岁酱吖の 提交于 2019-12-06 08:11:32
问题 I have a ATL COM service exe (MyService.exe), which compiles and runs fine. If I install this service (via MyService.exe /Service), it is successfully installed into the SCM. I can start the service through the SCM and it runs fine, under the LOCALSYSTEM account. My problem arises when I attempt to create an instance of a COM class defined by the service. My test harness application (MyServiceTest.exe), calls the following: ::CoInitialize(NULL); ::CoInitializeSecurity(NULL, NULL, NULL, NULL,

Custom Command Windows Services on HIGH Priority

ぐ巨炮叔叔 提交于 2019-12-06 07:53:33
问题 I have an Work Tracker WPF application which deployed in Windows Server 2008 and this Tracker application is communicating with (Tracker)windows service VIA WCF Service. User can create any work entry/edit/add/delete/Cancel any work entry from Worker Tracker GUI application. Internally it will send a request to the Windows service. Windows Service will get the work request and process it in multithreading. Each workrequest entry will actually create n number of work files (based on work

Getting server restart count in a day using c#?

时光总嘲笑我的痴心妄想 提交于 2019-12-06 07:29:47
问题 Is it possible to get the number of times a server gets restarted in a period of time using c#? I have seen this post which is getting windows last shutdown time Get the date-time of last windows shutdown event using .NET Any suggestion? 回答1: Have you considered reading from the server's event log? The 'USER32' system event source records shutdowns. From what I've read it seem that you should be able to read a remote machine's event log programmatically as well (See How to manage event logs

database connection doesn't work when service starts at boot but works when it's manually started

不羁岁月 提交于 2019-12-06 07:07:20
问题 I'm trying to track down possible causes of my app not being able to connect to a db server. I have a windows service that connects to the database when it starts. The service runs on machines with a reliable wired network connection. It's installed with startup Automatic so normally it starts when windows does, and in almost all cases this works fine. However, with one set of XP machines (that I don't have control of) the database connection fails when the service starts up with windows