windows-services

How can I define a dependency on SQL Server in a windows service that works with SQL Server Express

I'm using the following code to define a service dependency on SQL Server: serviceInstaller.StartType = ServiceStartMode.Automatic; serviceInstaller.ServicesDependedOn = new[] { "MSSQLSERVER" }; Installers.Add(serviceInstaller); Installers.Add(processInstaller); This works in two machines, one with SQL Server and the other with SQL S...

py2exe windows service problem

I have successfully converted my python project to a service. When using the usual options of install and start/stop, everything works correctly. However, I wish to compile the project using py2exe, which seems to work correctly until you install the EXE as a service and try and run it. You get the following error message: Starting ...

C# Logoff out a user via Windows Service

How do I logoff a user via a Windows Service? I found this example here but it will not work in a service. http://www.c-sharpcorner.com/UploadFile/thiagu304/desktopfunctions02112007140806PM/desktopfunctions.aspx ...

Oracle OCIEnvNlsCreate error when connecting from Windows service

As noted by the question's title, I'm trying to connect to an Oracle database from a Windows service and I am getting the following error message: System.Exception: OCIEnvNlsCreate failed with return code -1 but error message text was not available. Other applications on the same computer are connecting to Oracle without any issue...

Using Thread.Sleep() in a Windows Service

I'm writing a windows service that needs to sleep for long periods of time (15 hrs is the longest it will sleep, 30 mins is the shortest). I'm currently using Thread.Sleep(calculatedTime) to put my code into sleep mode. Is Thread.Sleep the best option or should I be using a timer? I've been googling this for a while and can't find a c...

Alternative to servicewrapper for java?

I've used ServiceWrapper a few times in the past, however, the dual license is somewhat complex for commercial products (generally you have to pay them). Are there are fully FOSS alternatives with similar functionality? ...

Why won't my .Net Windows service start automatically after a reboot?

I get the error below in the event log when the computer boots, the service is set to automatically start, when I manually start the service it starts without a problem. Any ideas? Service cannot be started. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.Inter...

Windows Service vs Windows Application - Best Practice

When should I go for a Windows Service and when should I go for a "Background Application" that runs in the notification area? If I'm not wrong, my design decision would be, any app that needs to be running before the user logins to the computer should be a service. For everything else use a background app. Is my decision right? Moreov...

Screen capture from windows service

I've got DirectShow based screen capture software. Internally it calls CopyScreenToBitmap function to grab screen. Then the picture is compressed by ffdshow. It works fine as a desktop application, but as window service, on certain computers it does not work (black picture). I've set 'Allow service to interact with desktop' and run that ...

Handle sys.exit() in cherrypy service

When you start/stop a python cherrypy service (compiled with py2exe), this works fine When I get a sys.exit() call (from my error handler), cherrypy quits, but the service remains hanging. Code: import cherrypy import win32serviceutil import win32service import sys SERVICE = None class HelloWorld: """ Sample request handler clas...

Wix: Stopping a Windows Service on uninstall

Hi, When I uninstall my service I get the error where it says I have to stop such and such service before uninstalling. This is unsatisfactory - the uninstaller should automatically stop it. I found a blog or newsgroup posting on this months ago and got it to work properly, but now it has stopped working for me. And I don't have a link...

Printing a PDF from a Windows service

With C#, how can I print a PDF document (without any dialog boxes in the background) to an indicated printer? ...

Automating Office via Windows Service on Server 2008

We have a Windows Service which runs on 2003 Server. It opens a source Word document using the Word Interop and then does some stuff with it. It also does likewise with Excel and PowerPoint files. Recently we've tried moving this service onto a Windows 2008 Server machine and are having real problems with it. COMException at Microso...

Setup Project for Windows Service won't build under Server 2008 (Visual Studio 2008).

Hey everybody We've got new machines here for doing development on running Server 2008. With Visual Studio 2008 we're having problems building a Setup Project which installs the Windows Service - Under Custom Actions then Uninstall, "InstallerClass property is only valid for assemblies". This builds and installs fine on XP SP3. Has a...

Removing Windows Logon screen through a service

I am trying to remove the windows logon screen (winlogon) from an executable launched from a service. The service would start automatically with windows and wait for commands from another computer. When it receives a command, it will launch an exe which will start cmd.exe under a particular username. The service is already present. I ha...

How do Threads work in Objects

hey guys, I'm totally inexperienced in terms of threads, so here's my question: How do threads work within an instance of an object, in particular, I'm working on a Windows Service. So, my Service is basically an instance of an Object right? So, say I have a System.Timers.Timer in my Service, and that fires an ElapsedEventHandler ever...

Windows Services open source framework

I was listening to a podcast a while back on an Open Source project. I can't remember what the project was called, but the guys doing it said they'd split out their Windows Service support into a separate Open Source project. Like I say, I can't remember the project or what they've called the break-out project. All I remember is that ...

Is it possible to create a standalone, C# web service deployed as an EXE or Windows service?

Is it possible to create a C# EXE or Windows Service that can process Web Service requests? Obviously, some sort of embedded, probably limited, web server would have to be part of the EXE/service. The EXE/service would not have to rely on IIS being installed. Preferably, the embedded web service could handle HTTPS/SSL type connections...

Consume WCF Service Hosted in a Windows Service

I wrote the WCF Service and hosted in windows service. I need to know how to consume this windows service in my client application. Note: I wrote Net pipe binding service. Edit: How can I write the client application for net pipe binding? ...

How can I call a windows service in a console application?

I wrote a WCF service and I would like to call this the net pipe binding way. I have deployed this in a Windows service. I wrote this method in my wcf service: Add(2,1) It should return 3 I don't know how to call the service hosted in windows in my client console application. I have started my service. Note: I would like to call...