windows-services

Long running Windows Services

Folks, I want to develop a long running windows service (it should be working without problems for months), and I wonder what is the better option here: Use a while(true) loop in the OnStop method Use a timer to tick each n seconds and trigger my code Any other options ? Thanks Essam ...

Windows Service Question

I have 3 Windows Service Question Is WS can work in background ? Is it possible to do some job every 2 minutes ? (if yes, can I get some help ?) How can I install WS in simple way ? (not with Installutil.exe .......) How can I run .exe file from Windows service ? I've tried this way: System.Diagnostics.Process G = new Process(); ...

SCardEstablishContext hangs as a service

Why might SCardEstablishContext hang, never to return, when called from a service? I have code that works fine on lots of Windows installations. It accesses a Cherry keyboard's Smart Card reader (6x44) to read data on a smart card. It works fine on most PCs it has been tried on. However, on some PCs, running in Spain with Spanish Window...

Call web service from .net 3.5 windows service

I'm building a new windows service with .net 3.5 and unlike 2.0 you cannot just add a web reference to a web service. Can you call a .net 2.0 web service from a .net 3.5 windows service? ...

.Net 3.5 Windows Service hide WCF Service Host

I got a Windows service installed on my development machine (that I made) and I want to interact with it. For a reason I don't know, each time I start the client, a WCF Service Host pop and said that the address is already in use ... which is true ... but how can I do to NOT start that Windows ? Is it because my two projects (server and...

How to kill own Windows Service

A WCF service is hosted in a Windows Service (WS). When the database (SqlServer 2005) goes down a SqlException is thrown due to the actions performed on the database. What I want to accomplish is that the WS - where the WCF service is hosted - should go down when the DB is also down. The WS will be restarted manually by the way. My...

How to debug a windows service using breakpoints?

I have a windows service with a timer. Its very hard to debug it. Because I start the service and put break points in different parts of the code. When I attach the process, I expect the service to start from the very beginning instead of some randome place in the middle code where I have break points. Its hard to debug like a normal app...

C#: Making an Installer that installs both a WPF application (ClickOnce) and a Windows Service

I currently have a VS Solution with 2 projects: a WPF application and a Windows Service. Now, I have managed to get ClickOnce working in installing my WPF application, but I also want a Windows Service to be installed (the one in the project) during this installation. I have found ways how to programmatically start a windows service ...

Same connection even though the ODBC data source has changed

I have a .Net service that has a list of strings containing ODBC connections and I use these in a loop to check multiple databases for tasks to process (eg. polling). However if i change where an ODBC connection points to..by changing its default database for some reason, even though i'm only storing the string name of the ODBC connecti...

Windows Service or Scheduled Task, which one do we prefer?

If we need to write a program that works periodically, which way do we prefer? Writing a windows service or writing a console application which works as scheduled task? ...

How to get name of windows service from inside the service itself

I have a bunch of win services written in .NET that use same exact executable with different configs. All services write to the same log file. However since I use the same .exe the service doesn't know its own service name to put in the log file. Is there a way my service can programatically retrieve its own name? ...

How can you run a process on another computer in .net

Let's say I have a windows service called "MyService" and an executable called "MyEXE" located on serveral computers on my network. Is it possible (from within "MyService") to start several instances of "MyEXE" on a diffrent/same computer, have it do some task and return a true/false result to a callback method in "MyService"? Somethin...

C# Windows Service throws an exception when trying to call a COM library.

Hi guys, I'm writing an application that uses a COM library. I have a class library that wraps the calls to the COM library and adds some more functionality. Eventually this will run as a Windows Service. For now I test it using a Winforms test harness. When the class library is created by the test harness everything seems to be working...

Storing C# Service Settings in Windows & Mono

I'm writing a C# service that I want to be able to use on Windows and Mono. I've just started experimenting with Mono and am trying to determine the best way to store settings to control the service that works for both Windows and Mono. Settings file where service is installed Pros: Same code for each platform, easy to find for editi...

Hosting a Silverlight compatible Web Service in a Windows Service

Is it possible to create a Windows Service (background apps accessible in services.msc) application and host an ASP.NET WebService or a Silverlight compatible WebService within it? I want to create a WebService that performs COM interop calls to something and decided that a Windows Service that interfaces with COM directly as well as ho...

Windows Service Development in .Net 3.5

Hi all, I am currently developing a Windows Service with a .Net 3.5 target. I am having a number of issues with this: Although I have a setup project in the solution it doesent install the service (platform is vista) even tho the installer completes successfully. I have to manually install the service using the InstallUtil.exe which ...

WPF Client communicating with WCF Windows Service over Network, Feasible?

At work, I want to create a WCF Windows Service that runs on a network server. Then I want to create a WPF application that can be installed on various machines on the network. This WPF application needs to be able to communicate with the WCF Windows Service on the network server. Is this feasible? Is there a better way to accomplish w...

WCF windows service as scheduled service

I've a .net WCF windows service running on an app server which keeps monitoring a folder for xml files. How do I make this service run only at a particular time (01.00 hours) everyday ? Thanks. ...

Error 1001 in my Windows Service app setup project.

I'm trying to install my Windows Service app using Visual Studio 2008 Setup and Deployment project. I have created a user account that has "Run as a Service" right and have set the ServiceProcessInstaller.Account to System.ServiceProcess.ServiceAccount.User and also the username and password to the user that I have created previously. ...

Unable to access SAN storage device

I am attempting to programmatically FTP a backup file that is stored on a SAN device. The device has been mapped on the server. I tested the application by running it from an icon on the desktop and it works perfectly. When I run the program through a windows service I get an error message saying that the drive cannot be found. The a...