I have a console application which i need to host as an independant windows service.
Any idea how to do that. I was able to register the service but when i try to start it, it gives me error :
Error 1053: the service did not respond to the start or control request in a timely fashion.
Services have to call specific WIN32 APIs to integrate with the Service Control Manager (SCM). This includes being able to receive service commands like stop).
An executable that doesn't call these APIs shortly after startup won't work. Ie. a service needs to be specifically written to be a service. (Note, in .NET this is done by extending ServiceBase rather than P/Invoking the Win32 APIs).
If you cannot modify the exe you have, consider creating a separate service exe that integrates with the SCM and launches/closes your console application.
Related
I have a COM+ application consisting of a client DLL and many middle-tier DLLs.
The application gets run by using an MSC application file.
When I am in die IDE and run my client DLL, I have the following run parameters to launch, run and debug my client DLL (this works great):
The theory is that I should be able to debug my middle-tier by running the DLL with the following parameters (I get the ProcessID from my COM+ Application in Component Services):
Once it is running, I should then be able to start my client MSC application and that should allow me to attach and debug my middle tier. I have seen this working before.
Running my Client DLL from the IDE or as an MSC application works without issues but when I try to debug my middle-tier, as described above, I get a "The RPC server is unavailable" error.
I am running everything locally so I am not sure what server it is referring too.
I have also made sure the following services are up-and-running:
DCOM Server Process Launcher, Remote Procedure Call (RPC) and RPC Endpoint Mapper
Any idea what else could cause this error or what server it is trying to connect too?
It turns out there were more than 1 version of the DLLs registered on my pc. I inherited the pc from a previous employee and noticed some install files of the application on the C drive (all my stuff is on the E drive). I ran the uninstall procedure on the C drive that also unregistered some DLLs and my RPC problem was resolved.
I have following applications:
1. Azure cloud application (mvc mobile web application)
2. Service Bus Relay application(currently console application)
In this user interacts with the cloud application and then I'm sending data to the relay service which we are going to host it in client premises. Right now all the data interactions are fine. I'm able to save and receive data.
As it is a console app it always run as a command prompt. I would like to convert service bus relay application as a windows service so that I won't get this command prompt window. Our client doesn't want command prompt to be run in their server. Is it possible to convert it as a service? or is there is any other way to do it? I see all the examples using console applications.
Please help.
If you're running your app in a Virtual Machine or Cloud Service (web/worker role), you can indeed install a Windows Service. You'd just have to code up the Windows Service shell (start/stop/etc) and incorporate Service Bus code.
If you're running your code as a Web App (in an App Service), then no, you cannot install a Windows Service, as App Service doesn't let you install such software (since everything runs in a sandbox).
I need to run a client server application in corba using c++ without using name service or without managing a shared file.
Basically want to run the server on one port and client should connect to this.
But the port will be read in client side and this needs to be communicated to server.
Is there a way to achieve this communicating the port from client to server.
I have an application that can run both as windows service or stand-alone console. It is deployed remotely, on my client's servers. When I remote desktop into the server, I use the same domain account that is used to run the windows service configuration of my application. Therefore, running the application as windows service or console is done absolutely under the same credentials. Or is it? The problem is that my console throws the "Access to Message Queuing system is denied" exception while the windows service doesn't have any issues with this. All the functionality of the application that accesses the MSMQ system is encapsulated into a .dll that is used by both the windows service and the console, so again, there should be no difference.
Any ideas as to what should I change?
I made a Windows Service that interact with MSMQ (a stupid data exchange application with no requirement regarding security).
I had to disable un-authenticated RPC calls using the Message Queuing properties pane in Computer management to make it work. Otherwise it throws System.Messaging.MessageQueueException (0x80004005): Access to Message Queuing system is denied.
Also the service run under Local System (which I remember is by default)
The user under which the service/console is executing should have access to MSMQ.
Please check if this is the case or not in your instance.
I have designed a simple windows service in .NET 2.0.
I am trying to deploy it on my local machine. I have switched to design view, and setup ServiceInstaller and ServiceProcessInstaller objects. There is a Project Installer. I have also wrapped the Windows Service into a .NET setup project and install it, leaving an .exe in the specified directory.
I have fired up cmd and entered the path to installutil. This works fine, but then I typeinstallutil and the full path to the service, in Visual Studio command prompt, and this does not work (I've also tried installutil /i and all sorts of things out of desperation). The permissions are local system (extensive).
Any ideas what I am doing wrong? For those here who have installed Windows Services, what was your methodology to install the service?
Thanks
We actually create an installer built into our application. It's a console app that has a command line to install/uninstall the server as well as run as a service or in console mode.
See this article on a Self Installing Service for some details. I like this method as it provides flexibility.
DESCRIPTION:
SC is a command line program used for communicating with the
NT Service Controller and services.
USAGE:
sc [command] [service name] ...
The option has the form "\\ServerName"
Further help on commands can be obtained by typing: "sc [command]"
Commands:
query-----------Queries the status for a service, or
enumerates the status for types of services.
queryex---------Queries the extended status for a service, or
enumerates the status for types of services.
start-----------Starts a service.
pause-----------Sends a PAUSE control request to a service.
interrogate-----Sends an INTERROGATE control request to a service.
continue--------Sends a CONTINUE control request to a service.
stop------------Sends a STOP request to a service.
config----------Changes the configuration of a service (persistant).
description-----Changes the description of a service.
failure---------Changes the actions taken by a service upon failure.
qc--------------Queries the configuration information for a service.
qdescription----Queries the description for a service.
qfailure--------Queries the actions taken by a service upon failure.
delete----------Deletes a service (from the registry).
create----------Creates a service. (adds it to the registry).
control---------Sends a control to a service.
sdshow----------Displays a service's security descriptor.
sdset-----------Sets a service's security descriptor.
GetDisplayName--Gets the DisplayName for a service.
GetKeyName------Gets the ServiceKeyName for a service.
EnumDepend------Enumerates Service Dependencies.
The following commands don't require a service name:
sc
boot------------(ok | bad) Indicates whether the last boot should
be saved as the last-known-good boot configuration
Lock------------Locks the Service Database
QueryLock-------Queries the LockStatus for the SCManager Database
EXAMPLE:
sc start MyService
Here's another reference specific to .NET services.
http://bytes.com/forum/thread739857.html
I'm calling installutil in my setup package and it works for me just fine.
That'd be great if you posted an error message that you're getting when running installutil.