windows-services

Remote debugging of a Java application launched as a Windows service

房东的猫 提交于 2019-12-23 17:09:56
问题 My Java application is started from within a native program through java.dll. This native program is launched as a service on Windows. The following options have been added to the JVM args for remote debugging: -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n In this configuration, it is impossible to connect from e.g. my Eclipse workspace. If the program is launched from the command-line, i.e. not as a service, I can connect to port 8787. How can I allow remote

How to show a form in windows service.

ⅰ亾dé卋堺 提交于 2019-12-23 13:26:18
问题 I want to load a form in OnStart() method in my windows service; here is my code. It is not working. Can you please provide any help ? protected override void OnStart(string[] args) { Form1 fr = new Form1(); fr.Show(); } 回答1: You can't use services that way. Services can't interact with desktop directly, because they run in another WindowsStation from the logged in users session. You need to create another application that will communicate with your service. How to make communication you can

Send data from Windows Forms application to Window Service

放肆的年华 提交于 2019-12-23 13:08:53
问题 I have a Windows Form where a user can enter data. This data, a complex struct, has to be communicated to a Window Service. How can I solve this problem in C#? 回答1: There are four ways to Interact with the windows service. Through Windows Registry Through WMI Through Command Through interop Here you can get more Details. 回答2: If you Right click on the References section in the solution explorer, you will see a menu item for adding a service reference. Once you set that up, you would just

How long can/should an NHibernate session be kept open?

 ̄綄美尐妖づ 提交于 2019-12-23 12:58:10
问题 I've created a windows service which is listening to a MSMQ. For each message I receive, some DB transactions need to be made. Later it might be possible that there will be 1 message every second. Currently the Nhib session is kept open until the service is stopped manually. Is it a good practice or should I close the session after each message? Thanks in advance 回答1: An NHibernate session is meant to be relatively short lived, so its generally not a good idea to keep it active for a longer

Detecting which version of IE is installed on your OS in C#?

若如初见. 提交于 2019-12-23 12:38:33
问题 I am currenting manintaining a windows service that programmatcially generates a HttpWebRequest and HttpWebResponse objects for retrieving the response message of the request. The UserAgent property of the HttpWebRequest was hard coded to use IE 6 as the browser agent. Is the a way to programmatcially detect which version of IE is installed on the server hosting the service? It is currently hosted on a Windows Server 2003 machine and might be installed on a Windows Server 2008 machine. 回答1:

LPR command to print pcl-file from windows service not working(Now a tray application)

不羁的心 提交于 2019-12-23 12:19:54
问题 I've been looking around for a while for a possible solution and explanation, but I can't find anything really. The following command is being run from a windows service. The same command does function if used directly in cmd. It does not return any errors or anything else for that matter. System.Diagnostics.Process process = new System.Diagnostics.Process(); System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); startInfo.WindowStyle = System.Diagnostics

Get the process id from the service name using c#

心不动则不痛 提交于 2019-12-23 12:19:44
问题 Is there possibility to get the process id from the service name without using management object in c#? Management object is not working when WMI service is in error state. 回答1: Hope this will help You. SELECT ProcessId FROM Win32_Service WHERE Name='MyServiceName' 回答2: try this: Process p = new Process(); p.StartInfo.FileName = "sc.exe"; p.StartInfo.Arguments = "queryex \"" + srv_name + "\""; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.StartInfo

False positive detection of c# .net program by anti-virus as trojan

时光怂恿深爱的人放手 提交于 2019-12-23 10:29:14
问题 I have developed a windows service using C#.Net which collects data and send to my server using custom APIs on a regular interval basis with the client user's permission. It was working fine until the user installed the anti-virus software (Kaspersky). It, false positively, detected my .exes as PDM:trojan.win32.generic , thrown away into quarantine and removed its service because I am doing web requests using HTTPWebRequest and HTTPWebResponse to push and pull data. As for temporary, I have

Can named pipe names have backslashes?

两盒软妹~` 提交于 2019-12-23 09:07:59
问题 According to MSDN, [The pipe name] must have the following form: \\.\pipe\pipename The pipename part of the name can include any character other than a backslash, including numbers and special characters. The entire pipe name string can be up to 256 characters long. Pipe names are not case sensitive. But there are plenty of examples where I've seen named pipe names with backslashes in them. For example, the standard pipe name for SQL Server is \\.\pipe\sql\query . Running PipeList from

Process.Start slow when spawning more new processes

眉间皱痕 提交于 2019-12-23 05:36:12
问题 Processes launched via Process.Start seems to have around a 26-second delay when the spawned process (the "child") launches more new processes (the "grandchildren") - I'm trying to find a way to solve this issue. Specifically, this is occurring when the original process (the "parent") is an ASP.Net website or a Windows Service (tried both). We're attempting to run a server-side command-line tool to gather information, make modifications in the file system, and continue with other processes