Groups | Blog | Home
all groups > dotnet windows forms > march 2007 >

dotnet windows forms : window service


Vinki
3/14/2007 7:32:07 PM
Hello Everyone,

I have created a very simple window service. This window service in turn
is calling a function that exist in a windows form.
When I am trying to run this windows service. window service does not run
and start throwing error message.
Once I remove the windows form and put that same method in a class and call
that class from window service, It works. I was wondering is it possible to
run the window service that is calling a method in windows forms.

Bryan Phillips
3/15/2007 12:00:00 AM
It is very dangerous to open forms inside a windows service. You could
lock up the windows service or the server itself.

--
Bryan Phillips
MCSD, MCDBA, MCSE
Blog: http://bphillips76.spaces.live.com



[quoted text, click to view]
Marius Horak
3/15/2007 2:18:27 AM
[quoted text, click to view]

I'm not sure what are you trying to say.
What is the differenve between windows service with a form and windows
service without a form?

Ciaran O''Donnell
3/16/2007 8:30:18 AM
The windows service runs in a logon context which doesnt have an interactive
session to present the form in. Therefore they dont work. If you want a
windows form interface to run in the background then try looking at a
notifyicon instead of a service or potentially as well as.
--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com


[quoted text, click to view]
Bryan Phillips
3/16/2007 8:21:05 PM
Basically, never instantiate a Windows Form inside a Windows Service.
Don't use the .Net Print classes inside a Windows Service either.
Ciaran's advice is wise and should be followed.

--
Bryan Phillips
MCSD, MCDBA, MCSE
Blog: http://bphillips76.spaces.live.com



[quoted text, click to view]
AddThis Social Bookmark Button