windows-services

Why windows service not start automatic after windows start

邮差的信 提交于 2019-12-02 12:19:10
Why windows service not start automatic after windows start. I set service installer property start type to automatic. Is there other property which need to be set? Logon for service is local system account. And service can be started manually every time. This happens most often when a resource needed by your service is not available when Windows tries to start it. Please review what your service needs to operate and ensure that you setup a dependency for each resource required. For example, if your service uses the network, try making it dependent on the "Workstation" service (named

Starting a service in ASP.NET/C# with the right permissions

故事扮演 提交于 2019-12-02 12:13:38
on my website (written in ASP.NET/C#) I want the moderaters to be able to start a certain service. The code I have for this is: ServiceController svcController = new ServiceController("InvidualFileConversion"); if (svcController != null) { try { svcController.Stop(); svcController.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromSeconds(10)); svcController.Start(); } catch (Exception ex) { // error } } Now when I run this I get the error "Cannot open InvidualFileConversion service on computer", with the additional message: "Acces is denied". I know this is a problem with permissions

wmic via .NET or C#

徘徊边缘 提交于 2019-12-02 11:59:01
All, Please forgive my ignorance of C#/.NET, I am absolutely new to both (mostly Java, C/C++) and find myself tasked with creating some code that performs the same thing as the "wmic qfe" and "wmic os" commands available at the DOS prompt. Can this be done? If so, any help is appreciated. I am trying to working my way through the System.Management.Instrumentation namespace since wmic is an acronym for Windows Management Instrumentation Command (according to Google), but have as yet to discover anything useful. Thanks in advance, Toddw You will indeed need to use the System.Management namespace

Ninject, DbContext & Windows Service - New Instance Each Time Thread Runs?

旧巷老猫 提交于 2019-12-02 11:17:09
I'm current writing a Windows Service which connects to an existing service layer using Entity Framework (DbContext), and Ninject to inject the Respositories and DbContext instance. This is pretty much working with one caveat - I want a brand new DbContext instance each time the thread runs, whereas at the moment I'm getting the same one for the entire thread lifetime. My binding looks like this: Bind<IDbContext>().To<EnterpriseDbContext>().InThreadScope(); Bind<IUserRepository>().To<UserRepository>().InThreadScope(); // And other repositories And my thread code looks like this: [Inject]

C# Windows Service

我与影子孤独终老i 提交于 2019-12-02 10:21:19
Scenario I've created a windows service, but whenever I start it, it stops immediately. The service was concieved from a console application that used to subscribe to an event and watch processes on a server. If anything happened to process (i.e. It was killed), then the event would trigger the process to be restarted. The reason I'm telling you this is because the original code used to look like this: Original Console App Code: static void Main(string[] args) { StartProcess sp = new StartProcess(); //Note the readline that means the application sits here waiting for an event! Console.ReadLine

Accessing Google Drive from Windows service

孤人 提交于 2019-12-02 09:01:41
问题 I'm trying to understand if it's possible to access a Google Drive from a traditional Windows Service, without involving the user. Following the guides on https://developers.google.com/drive/quickstart, I've been able to create a command line application which uploads a file to Google Drive. However, this application launches the web browser and redirects me to Google's Authorization Server page which gives me an authorization code I have to enter in the command line app. Obviously this won't

make an interactive windows service

喜欢而已 提交于 2019-12-02 08:08:57
问题 I want my Java application to be an interactive windows service (a windows service that has GUI when the user is logged in). I searched for this and I see that the way to do it is to have 2 programs, 1st is a service, 2nd is a GUI program and make them communicate - the service will get commands from the GUI program. Just before I started to split my program, I noticed that in "Java Service Wrapper" there is a flag: wrapper.ntservice.interactive=TRUE Is this flag an automatic way to do the

Should I block even when I'm sequentially processing

我的未来我决定 提交于 2019-12-02 07:36:31
I have a windows service that periodically needs to do some work. So I set up a System.Timers.Timer to do this. Lets assume that its possible that the processing time could be greater than the timer interval. Lets also assume it would be a very bad thing if this happens. To avoid this I'm setting the AutoReset on the Timer to false and then calling start in my process. public partial class Service : ServiceBase{ System.Timers.Timer timer; public Service() { timer = new System.Timers.Timer(); //When autoreset is True there are reentrancy problme timer.AutoReset = false; timer.Elapsed += new

Writing values to the registry with C#

做~自己de王妃 提交于 2019-12-02 07:18:31
问题 I'm in the process of creating a C# application which will monitor changes made to the registry and write them back to the registry next time the user logs on. So far I've got it monitoring changes, reporting them, writing the hive, key and value to a text file. I'm now at the point where I need to take them values out of the file and place them back into the registry. Now I've looked at various tutorials but none have been able to answer the question/problem I have, so for example the

Printing from a Windows Service

随声附和 提交于 2019-12-02 06:24:30
问题 Ok, I am trying to print a page from a windows service that I installed using a Visual Studio setup project. At first I set the Account property yo Local System, but it will tell me that there are no printers installed (and there are). So I changed it to user and now it just doesn't print (no error or anything). I did some Googleing and basically it said that "Interact with Desktop" should be enabled. To programatically do this you need to edit the registry settings for this service (which