windows-services

C# Windows Service that connects to network through VPN

空扰寡人 提交于 2020-03-05 01:34:28
问题 I have a Windows Service that must connect, via VPN, to the network in order to send emails. What I need to do (when I start the service) is check whether the VPN connection exists, if not create it, and then connect to the network. I was looking at DotRAS which looks ideal for doing all the work, however, it doesn't seem to provide a method for creating a new VPN connection. So my question is, is there a way in which I can programmatically create a VPN connection? 回答1: Use a scriptable VPN

How to get service executable file path

隐身守侯 提交于 2020-02-29 06:18:05
问题 Is there anyways to get the executable file path of a running Windows service without requiring administrator execution level privilege in .Net? (Without causing the UAC to get the user's confirmation) 回答1: Here's a possible solution using WMI: using System.Management; String query = String.Format("SELECT PathName FROM Win32_Service WHERE Name = '{0}'", serviceName); using (ManagementObjectSearcher mos = new ManagementObjectSearcher(query)) { foreach(ManagementObject mo in mos.Get()) Console

RabbitMQ consumer as a windows service

被刻印的时光 ゝ 提交于 2020-02-27 11:59:27
问题 I have a rabbitmq consumer application implementing "publish/subscribe pattern in .net, which runs perfectly as a console application but when I deploy that as a windows service it does not seem to be saving the data into mongodb. protected override void OnStart(string[] args) { try { var connectionString = "mongodb://localhost"; var client = new MongoClient(connectionString); var factory = new ConnectionFactory() { HostName = "localhost" }; using (var connection = factory.CreateConnection())

WTSSendMessage don't show messagebox on remote desktop

早过忘川 提交于 2020-02-25 13:41:27
问题 I have a Windows service application that displays a confirm popup for further action. It works fine when I install the service application on my local machine, but when I install it on the remote machine, the confirm popup is not getting displayed. [DllImport("Kernel32.dll", SetLastError = true)] static extern int WTSGetActiveConsoleSessionId(); public static IntPtr WTS_CURRENT_SERVER_HANDLE = IntPtr.Zero; public static int ConfirmPopup(string message, string title) { try { WTSSendMessage

Calling Windows Service from a Web Service

£可爱£侵袭症+ 提交于 2020-02-24 11:11:30
问题 I am using .Net 2.0 framework and would like to call a function in Windows service from a web service. Is this possible? And If yes, how much control I will have over the function i.e passing parameters, getting the result back etc. Any ideas would be greatly appreciated :) 回答1: Remoting is your best option if you need to pass parameter values. If you don't need to share objects or anything too complex, ServiceController is probably easier. 回答2: You can do it through .NET remoting. If you go

Calling Windows Service from a Web Service

我怕爱的太早我们不能终老 提交于 2020-02-24 11:11:22
问题 I am using .Net 2.0 framework and would like to call a function in Windows service from a web service. Is this possible? And If yes, how much control I will have over the function i.e passing parameters, getting the result back etc. Any ideas would be greatly appreciated :) 回答1: Remoting is your best option if you need to pass parameter values. If you don't need to share objects or anything too complex, ServiceController is probably easier. 回答2: You can do it through .NET remoting. If you go

Calling Windows Service from a Web Service

删除回忆录丶 提交于 2020-02-24 11:11:03
问题 I am using .Net 2.0 framework and would like to call a function in Windows service from a web service. Is this possible? And If yes, how much control I will have over the function i.e passing parameters, getting the result back etc. Any ideas would be greatly appreciated :) 回答1: Remoting is your best option if you need to pass parameter values. If you don't need to share objects or anything too complex, ServiceController is probably easier. 回答2: You can do it through .NET remoting. If you go

How to ensure that a service is always running after logging out and back in again

白昼怎懂夜的黑 提交于 2020-02-23 07:06:51
问题 I have a custom C# Windows Service. It has detailed logging set up and graceful shutdown processes, which include logging out when shutting down. Specifically, the program is an .exe , which calls ServiceBase.Run(container.Resolve<MyWindowsService>()); in its Program.Main() method. I have logging in the (overridden) MyWindowsService.OnStop() method, and in a finally block of the Program.Main() method. The service is installed and configured for Automatic start in Windows Services. When

Log to debug Windows Service dying on Sign-out

假如想象 提交于 2020-02-23 06:43:11
问题 I have a custom C# Windows Service. It has detailed logging set up and graceful shutdown processes, which include logging out when shutting down. Specifically, the program is an .exe , which calls ServiceBase.Run(container.Resolve<MyWindowsService>()); in its Program.Main() method. I have (NLog) logging in the (overridden) MyWindowsService.OnStop() method, and in a finally block of the Program.Main() method. The service is installed and configured for Automatic start in Windows Services When

Unable to browse repository after setting visual SVN Server

懵懂的女人 提交于 2020-02-20 09:49:58
问题 I have setup VisualSVN Server 2.1.7 on my windows 7 x64 system. I have used all default options : Installed path : C:\Program Files (x86)\VisualSVN Server Repositories path : D:\Repositories Server name, port : testsrvr, 8443 (use secure connection = checked) Using "subversion authentication". I have created a user and a test repository. Given "Read/Write" access to that repository for that user. When I try to browse the repositories, IE shows "Internet Explorer cannot display the webpage". I