windows-services

Unable to execute SQL command in windows service

断了今生、忘了曾经 提交于 2019-12-11 08:13:11
问题 I'm working on creating a windows service that will send emails to a customer when they are within a month of having their submission expire. I'm using vb.net in Visual Studios 2008 Because it's a windows service it's very difficult to debug. Trying to narrow down my error I created a "sendDebugEmail" method that sends me an email if it gets to a certain line. The emails never make it past "dr = cmd.ExecuteReader()" I'm wondering what I am doing wrong. My SQL statement should work fine. I've

When running as a windows service, how do i get the number of active monitors? C++

社会主义新天地 提交于 2019-12-11 07:51:47
问题 I have ran into an issue when retrieving the number of active monitors while the exe is running as a windows service. I have tried using EnumDisplayDevices and GetSystemMetrics(SM_CMONITROS) to get the number of monitors, these two methods woulds give me the correct number of monitors when running them as console mode (meaning initiated by the user), but when I register the exe as a service and run it through the windows service, the number of monitors that was reported turned out to be

Async fire and forget operation with callback

偶尔善良 提交于 2019-12-11 07:50:09
问题 I have an Mvc3 application with a forum area where questions can be posted also by e-mail. The process for getting the emails from different accounts, parsing them and inserting in the db is really slow. I thought at first to create a separate Windows Service with some scheduled process that would do all the separate email processing every few seconds. I arrived to think that a better approach would be to initiate the email checking/parsing process when a user arrives in the forum section

Restart a windows services from C#

被刻印的时光 ゝ 提交于 2019-12-11 07:36:39
问题 How do I restart a currently running service in C#. 回答1: You can use ServiceController. Example here. 回答2: Use the ServiceController class. 回答3: ServiceController _ServiceController = new ServiceController([NameService]); if (_ServiceController.ServiceHandle != null) { _ServiceController.Stop(); _ServiceController.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromMilliseconds([Time])); _ServiceController.Start(); _ServiceController.WaitForStatus(ServiceControllerStatus.Running,

Use Com class from LocalSystem

折月煮酒 提交于 2019-12-11 07:29:13
问题 I'm using a Com object. The com server should be used from a Windows service running as a specific account. But when running in this account it can't load the com, giving me this exception: Creating an instance of the COM component with CLSID {36998A63-857C-4B87-BC5E-72B7B3573F80} from the IClassFactory failed due to the following error: 80010105. I tried changing the account to LocalSystem, that still fails, but changing the Windows service to log on as my own account works. I guess it has

file path using C#

99封情书 提交于 2019-12-11 07:25:35
问题 I have a windows service which is using a method from a class library with same asp.net solution. in class library, I have a method with following line: reader = XmlReader.Create(HttpContext.Current.Server.MapPath("~/TestDevice/Data.xml"), settings); When control comes to this line. I get exception. I tried to debug the code and found that when service tries to access this method then HttpContext.Current.Server is null. What is alternative syntax. I tried to access this class library method

Could not load file or assembly or one of its dependencies. Access is denied [duplicate]

夙愿已清 提交于 2019-12-11 07:19:20
问题 This question already has answers here : Could not load file or assembly 'someProject' or one of its dependencies. Access is denied (7 answers) Closed 5 years ago . Now I decided to ask for some help. After having investigate for 2 days on my issue, I cannot figure out any solution. Maybe I will be luckier here! So here is my issue: On our production server (Windows Server 2008) we have a windows services running which is responsible to run some Jobs automatically. These jobs are configurable

How to invoke WCF RESTful Service in Windows Service in asp.net?

主宰稳场 提交于 2019-12-11 07:12:09
问题 I have created below Operation Contract for POST Method in WCF RESTfule Service. IService1.cs:- [OperationContract] [WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json, UriTemplate = "/SaveCustomerPost", BodyStyle = WebMessageBodyStyle.Wrapped)] string SaveCustomerDetails(CustomerDetails objCustomerDetails); [DataContract] public class CustomerDetails { [DataMember] public string Name { get; set; } } Windows Service:- using (WebChannelFactory<ServiceReference1.IService1> cf =

could not start the sphinx search service on local computer?

孤人 提交于 2019-12-11 06:58:42
问题 i am getting this Windows could not start the SphinxSearch service on Local Computer. Error 1067: The process terminated unexpectedly. i got installation instruction from this . http://blog.robbsnet.com/2011/07/how-to-install-and-implement-sphinx.html build process is complete but when i start the sphinx search service i got errors . 回答1: Try running searchd manually from Command Prompt. Maybe it will give you a useful error message. Try also looking in searchd.log 回答2: For anyone who is

How can I set sort of “Start in”-path for a Windows Service

馋奶兔 提交于 2019-12-11 06:51:27
问题 I have following class, which is used by a Windows Installer project, to install a service: [RunInstaller(true)] public sealed class Installer : System.Configuration.Install.Installer { private readonly string _installDir; public Installer() { var locatedAssembly = this.GetType().Assembly.Location; this._installDir = Path.GetDirectoryName(locatedAssembly); var serviceProcessInstaller = new ServiceProcessInstaller { Account = ServiceAccount.LocalSystem }; var serviceInstaller = new