Windows Service - Error 1053

G

Guest

I have created a WinForm application that needs to be run as a windows
service (the PC is inaccesible by any user) i have successfully installed the
application as a windows service. When i start the service, i get the
following error

Error 1053: The service did not respond to the start or control request in a
timely fashion
1. Is there anyway to extend the timeout period.? I use timed threads to
load a serial device driver and this takes time

2. To enable the service to act correctly i assume that the application must
have OnStart and Stop methods. As the Winforms app already inherits
Windows.Forms.Form, how do i also make it inherit
System.ServiceProcess.ServiceBase so I can correctly start and stop (there
are cleanup operations on close)

Thank you for your help in this matter

..Net Framework v 1.1.4322.573
 
W

W AKthar

Hi Richard,

This not an anser to your question but more of a help
question.
I too have tried to create a WinForm windows service biut
have not be able to. Can you please tell me how to do
this??
 
G

Guest

So far i have developed the following method

Create your WinApp as normal (look out for further replies from knowledgable
people re: System.ServiceProcess, re my question) you have to then setup a
windows service installer look at the following
http://www.c-sharpcorner.com/Code/2003/Oct/DynamicServiceInCSharp.asp to
create the service (I have used this to develop a standalone app that will
install any service)
Use installUtil (look in dotnet framework SDK) to install the service
installer and make sure the imagepath points at your executable -

When you have setup the service make sure that the app can interact with the
windows desktop (right click the service in service manager). So far that is
where i am. The app starts then closes after a timeout - this is where i am
stuck

Hope that helps, if you get further than me, let me know]

Richard
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

The start process should be a fast one, my advice is to create a thread and
do the lengtly operation there. This is the corect way to implement it
anyway.

Another thing, a win app is VERY DIFFERENT from a windows service, in fact
in a win service you should not use any Windows.Forms.Form classes.

I suggest you to take a look at the how-to of creating a win process.

Cheers,
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,


Richard Steele said:
So far i have developed the following method

Create your WinApp as normal

This is wrong, you should select as the project type Windows service, I
think this is why you are getting the errors you have, a win service is a
COMPLETELY DIFFERENT thing than a win app.

Create a new project with this type and check the code generated, you will
see what I mean

Cheers,
 
W

Willy Denoyette [MVP]

Ignacio Machin ( .NET/ C# MVP ) said:
Hi,

The start process should be a fast one, my advice is to create a thread
and do the lengtly operation there. This is the corect way to implement it
anyway.

Another thing, a win app is VERY DIFFERENT from a windows service, in fact
in a win service you should not use any Windows.Forms.Form classes.

I suggest you to take a look at the how-to of creating a win process.

Cheers,

You are right, as rule number 1, "Windows Services" should have a user
interface nor should it use UI elements like a MessageBox, that's also the
reason why the "service" project wizard doesn't include the code to
create/initialize a Windows Form. But as always people are in search to find
alternative ways to build "Windows Forms Services" and sooner than later
they get stuck, because of rule 1.

Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top