windows-services

How to launch a Winforms app from a windows-service

回眸只為那壹抹淺笑 提交于 2019-12-11 14:50:08
问题 Hello i am trying to launch an interactive process - a winforms app - from a windows service on the current session. I do not know how to do that.I am using TopShelf and i tried launching the process using the WhenSessionChanged hook provided by TopShelf . I can get the sessionId var exitCode = HostFactory.Run(x => { x.Service<MyService>(s => { s.ConstructUsing((h) => new MyService()); s.WhenStarted(t => t.Run()); s.WhenStopped(t => t.Stop()); s.WhenSessionChanged((anubis, args) => { string

Windows service not executing after first run

女生的网名这么多〃 提交于 2019-12-11 14:14:42
问题 I have create a windows service in VS 2010. I install it and also run it at the same time and set startup type to Automatic . I see it running fine through EventViewer and is successfully completed. But after that i done see EventViewer showing anything, even if the work is doen it still should check DB and skip as all rows done. So what is the issue ? DO i need to make it an infinite loop in the service to keep it running? Something like While (ROWs in DB ! = null) ? Because it does not seem

How to create a windows service to schedule some task like delete the files on a certain folder? [closed]

谁说胖子不能爱 提交于 2019-12-11 14:12:58
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . Hi i am relatively new to windows service. I want to create a schedule task that will go through certain folder like c://dev/ and delete the files that are created between some date/time. How can i achieve this

monitoring applications file access in Windows

ⅰ亾dé卋堺 提交于 2019-12-11 14:07:32
问题 I need to monitor applications File Access in win 7 operating system. I want to monitor which software read, write or create file in which place. I think, this work is imposible with File System Watcher and auditing. how can I do this work with C#? Are there any appropriate APIs? 回答1: You need a filesystem filter driver for fine-grain monitoring and tracking what applications access files. Developing a kernel-mode driver requires C programming and special knowledge. You can write a driver

ASP.NET MVC 4 application to Call Windows Service

扶醉桌前 提交于 2019-12-11 13:23:09
问题 We are using distributed architecture for our project. In which UI layer is reside on one server and Business Layer on another server. We are creating Windows service of Business layer. Is it possible to call the windows service from another server UI application. How to do it? 回答1: There are a couple of options for communicating with a windows service. A service bus In Proc hosted WebAPI Self hosted WCF Service SignalR to message between client and server 回答2: You could create a self hosted

Install/Uninstall a Windows Service in a build script with NAnt

為{幸葍}努か 提交于 2019-12-11 13:19:50
问题 Does NAnt have the ability to install or uninstall a windows service, using the InstallUtil utility or whatever else? 回答1: You can call Nant's exec task to call InstallUtil and can pass parameters to install or uninstall a service easily <target name="install-service"> <exec program="${framework::get-framework-directory('net-2.0')}\InstallUtil.exe"> <arg value="-i" /> <arg value="/name=V1" /> <arg value="C:\Service\SomeService.exe" /> </exec> </target> 回答2: Nant or MSBuild? What's the problem

ServiceType in AssemblyInstaller

谁说我不能喝 提交于 2019-12-11 12:56:13
问题 I want to install a windows service programmatically by the example. Here is the code snippet. private static AssemblyInstaller GetInstaller() { AssemblyInstaller installer = new AssemblyInstaller( typeof(YourServiceType).Assembly, null); installer.UseNewContext = true; return installer; } I don't know what is the "YourServiceType" here. The syntax of AssemblyInstaller Constructor in MSDN is public AssemblyInstaller( Assembly assembly, string[] commandLine ) UPDATE: The wild thing is that I

.NET Windows Service from dll

一个人想着一个人 提交于 2019-12-11 12:01:57
问题 I have a Windows Service and Service Installer inside of a .NET class library (not an exe). Once the service is installed via installutil, when trying to start, I get the error Windows could not start the xxx service on Local Computer Error 193: 0xc1 In googling I found that this error might be due to the fact that my service is part of a dll, not an exe. Could this be the problem? If so, how can I resolve the issue? If not, what else could be the problem. 回答1: In VS.NET go to New Project

How to make a ASP.NET website communicate with TCP server application

穿精又带淫゛_ 提交于 2019-12-11 12:00:10
问题 I have an architecture where some set of hardware is administered and monitored through a server application (communicating through TCP Sockets and also updating database related to hardware). There is also an asp.net website through which a user should be able to get the realtime status of the hardware through the tcp server. the tcp server and the website will be hosted on the same machine. My question is how can I make the USER interact with the TCP SERVER? One way I came across was to

Same Code, But Different Results in Windows Form and in Windows Service During Socket Connection

老子叫甜甜 提交于 2019-12-11 11:45:50
问题 I have a code which acts as a Socket listener (server side), and I implement it in the WinForms and in the Windows Service . Everything inside is the same, except that I changed the implementation of Windows Service OnStart and OnStop to buttonStart_Click and buttonStop_Click in WinForm . Here is the code for WinForm : private void buttonStart_Click(object sender, EventArgs e) { //should start to listen to the TCP/IP if (serverHandler.IsMyTargetPortBusy()) return; try { serverHandler