Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / December 2005

Tip: Looking for answers? Try searching our database.

Notepad.exe within Windows Service ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Zeeshan Gulzar - 30 Dec 2005 15:13 GMT
This application is sort of remote execution. I use C#.NET

I have created a windows service listening a port say 4000. When client
connected to the listener; send a special packet containing executable file
name with command line arguments, server start this exe at own machine(server
itself).

Server start this process by using Process class, but the problem is that

if i say the exe is notepad.exe. server started notepad successfully but in
background and does'nt show it's GUI but can view at task manager->Processes
tab not appear in task manager->Application tab.

ProductInstaller modifiers is public, Account = LocalSystem.

Without Windows Service wrapper, this application is working perfectly

Please help urgently. Thanks in advance
Zeeshan Gulzar
Zvonko Keber - 30 Dec 2005 15:21 GMT
Did you try setting the "Allow service to interact with desktop" inside:

Computer management --> Services --> "your service" --> Properties --> Log
On tab

When you change it, you need to restart the service.

> This application is sort of remote execution. I use C#.NET
>
[quoted text clipped - 19 lines]
> Please help urgently. Thanks in advance
> Zeeshan Gulzar
Zeeshan Gulzar - 30 Dec 2005 15:32 GMT
Thanks Keber
Yes i have tested it but still in background.

> Did you try setting the "Allow service to interact with desktop" inside:
>
[quoted text clipped - 26 lines]
> > Please help urgently. Thanks in advance
> > Zeeshan Gulzar
Lau Lei Cheong - 31 Dec 2005 02:18 GMT
Are you logging in the console session (i.e. Session #0)?

The UI of an interactive service will only appear on console session, but
not other user session.(Normally remote desktops)

"Zeeshan Gulzar" <ZeeshanGulzar@discussions.microsoft.com> ¼¶¼g©ó¶l¥ó·s»D:89CAEA36-D639-4814-BB67-570DDED15A9E@microsoft.com...
> Thanks Keber
> Yes i have tested it but still in background.
[quoted text clipped - 32 lines]
>> > Please help urgently. Thanks in advance
>> > Zeeshan Gulzar
Zeeshan Gulzar - 31 Dec 2005 04:43 GMT
Thanks for your replys
This problem is solved by
  Process.StartInfo.WindowStyle = ProcessWindowStyle.Normal
what i am facing is,  due to any other value of ProcessWindowStyle

Thanks again

> Are you logging in the console session (i.e. Session #0)?
>
[quoted text clipped - 38 lines]
> >> > Please help urgently. Thanks in advance
> >> > Zeeshan Gulzar
Richard Grimes - 31 Dec 2005 17:46 GMT
> Thanks Keber
> Yes i have tested it but still in background.
>
>> Did you try setting the "Allow service to interact with desktop"
>> inside:

Don't do this. It is considered a bad thing to do. The reason is that
the GUI system is a secure object called a Window Station. Windows are
shown on another secure object called a Desktop and each Desktop can
exist in only one Window Station. Using the "Allow service to interact
with desktop" is effectively a hack to get around the Window Station
security. The accepted way to do this is to run a process in the
interactive Window Station (ie the interactive user account) that
listens for communication from the service (for example via .NET
remoting) and the interactive app will then show windows to the user.

Of course, if you are writing an app that runs in the interative user
Window Station and listens on some interprocess communication endpoint
then you may as well get this application to listen on the port and
forget about the service. Which raises the question, why do you need
your listener to be a service? If you need it to run when the system
starts then the startup folder or the registry run key is just as good.
If you need it for the security aspect, think carefully if you really do
need to run under LOCALSYSTEM or some other named privileged account
(because events will be audited against those specific accounts and you
may think that it is more useful to do auditing against the interactive
user account).

In many cases when people say they *must* write a service, if they think
it through they come to the conclusion that an ordinary process can do
the job just as well.

Richard
Signature

Fusion Tutorial: http://www.grimes.demon.co.uk/workshops/fusionWS.htm
Security Tutorial:
http://www.grimes.demon.co.uk/workshops/securityWS.htm


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.