windows-services

Windows service installer not reading App.Config file

邮差的信 提交于 2019-11-29 21:12:43
问题 I have added App.Config in my project. I have a installer class(ProjectInstaller.cs) which needs to read values from App.config. I am providing the keys . Below is the sample Code : ConfigurationManager.AppSettings["CONFIG_FILE"] I am getting null values as per above code ,when invoked in Installer class. But in App.Config file the value for the above key exists. 回答1: Try: public string GetServiceNameAppConfig(string serviceName) { var config = ConfigurationManager.OpenExeConfiguration

Consuming a WCF Service that is hosted in a Windows Service from outside solution

▼魔方 西西 提交于 2019-11-29 21:03:13
问题 I've set up a WCF Library hosted in a Windows Service using the following walk-through: http://msdn.microsoft.com/en-us/library/ff649818.aspx The consumer winforms is in the same solution, which is located locally on my work PC's C: drive. The walk-through works i.e. the winforms button gives me the correct answer. If I create a new Solution on the C-Drive with a single Windows Forms project in it I cannot successfully add a service reference to this running service, i get the following

Caching for .NET (not in websites)

佐手、 提交于 2019-11-29 20:41:15
问题 I need a cache that responds to memory pressure like the one build-into ASP.NET. I'm not using a web site, however, I'm building a Windows Service. Any suggestions? (code, techniques, products, I don't care as long as it's in-memory) 回答1: If you're familiar with the ASP.NET Cache ( System.Web.Caching ), you can still reference and use it, even if you're not running within a web application. 回答2: Caching Application Block from Microsoft Paterns & Practices. Project Velocity from Microsoft. 回答3

Simplest way to restart service on a remote computer

[亡魂溺海] 提交于 2019-11-29 20:33:56
What's the easiest programmatic way to restart a service on a remote Windows system? Language or method doesn't matter as long as it doesn't require human interaction. As of Windows XP, you can use sc.exe to interact with local and remote services. Schedule a task to run a batch file similar to this: sc \\server stop service sc \\server start service Make sure the task runs under a user account privileged on the target server. psservice.exe from the Sysinternals PSTools would also be doing the job: psservice \\server restart service DESCRIPTION: SC is a command line program used for

Multithreaded service, BackgroundWorker vs ThreadPool?

断了今生、忘了曾经 提交于 2019-11-29 20:27:59
I have a .NET 3.5 Windows Service. I'm testing with a small application that just sleeps threads after starting them, for random timespans of 300 to 6500ms. I have various questions about this issue. Is BackgroundWorker really intended for use just in WinForms applications or is this just nonsense, how exactly is it tuned to this effect? I've read about ThreadPool s in this question and this one . I'm not exactly sure how much it is a problem for me that the threads would last somewhere between half a second and a few seconds. Is this reason enough to look somewhere else? Am I best off just

A standalone Delphi application that can also be installed as windows service

倖福魔咒の 提交于 2019-11-29 20:08:10
In Delphi you can create a standalone Windows VCL Forms application. You can also create a Windows service application. Is it possible to combine the two in a single application that can run as a standalone application and can also be installed as a Windows service? Totally possible. The trick is to edit the .dpr to create main form when you want to run as an application and the service form when you want to run as a service. Like this: if SvComFindCommand('config') then begin //When run with the /config switch, display the configuration dialog. Forms.Application.Initialize; Forms.Application

Using InstallUtil and silently setting a windows service logon username/password

穿精又带淫゛_ 提交于 2019-11-29 19:58:57
I need to use InstallUtil to install a C# windows service. I need to set the service logon credentials (username and password). All of this needs to be done silently. Is there are way to do something like this: installutil.exe myservice.exe /customarg1=username /customarg2=password Jimbo A much easier way than the posts above and with no extra code in your installer is to use the following: installUtil.exe /username=domain\username /password=password /unattended C:\My.exe Just ensure the account you use is valid. If not you will receive a "No mapping between account names and security id's was

Installing a windows service from a Visual Studio Installer project

一世执手 提交于 2019-11-29 19:58:13
A colleague has written a Windows Application and left me to do the installers. I have created the installer project through Visual Studio and added the primary output of the service project to the new project. When I run the installer it creates the correct folders and copies the dlls, exe and config file in, but it doesn't do the actual install of the service. The service isn't listed in the Services window, and if I double click on the exe I'm told I need to run installutil to install the service. How do I make the installer do this bit for me? I found this article: http://www.codeproject

Windows service start failure: Cannot start service from the command line or debugger [duplicate]

谁说胖子不能爱 提交于 2019-11-29 19:50:38
This question already has an answer here: Run a Windows Service as a console app 6 answers hi i'm getting this error Cannot start service from the command line or debugger. A winwows Service must first be installed(using installutil.exe) and then started with the ServerExplorer, Windows Services Afministrative tool or the NET START command. and i dont understand why im geting this error. And here is my code: { string Hash = ""; string connectionstring = ConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString; SqlConnection myConnection = new SqlConnection(connectionstring

Any way to override .NET Windows Service Name without recompiling?

假装没事ソ 提交于 2019-11-29 19:15:27
I have a windows service executable that I know is written in .NET which I need to install under a different service name to avoid a conflict. The install doesn't provide anyway to specify a service name. If I only have access to the binary, is there anyway to override the service name when I install it with installutil? Josh Yeager Do you have to use InstallUtil? Here are the commands to do what you want using sc: sc create MyService binPath= "MyService.exe" DisplayName= "MyService" sc description MyService "My description" Reference: http://support.microsoft.com/kb/251192 It is not true that