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 / Distributed Applications / February 2004

Tip: Looking for answers? Try searching our database.

Windows Service not able to run external application

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Simon Knox - 02 Feb 2004 00:15 GMT
Hi

I have a windows service that periodicly checks for orders. The orders are
converted to pdf files and then the pdf files are placed into a zip file and
emailed.

The problem I have is that to create the zip file I use Process.Start and
pass it a string containing the path to winzip and the files to zip as
arguments. This works fine when I do it from a Windows Forms application but
when I do it from the Windows Service it doesn't work. I don't get any
errors just no zip file.

I thought that it maybe a permissions error but the Windows Service is
running as the Local Service account so I would have thought that would be
sufficent permissions.

Any help or ideas with this would be greatly appriciated.

Thanks

Simon
MSFT - 02 Feb 2004 08:44 GMT
Hi Simon,

Thank you for using the community.

Regarding the problem, I also suspect it is a permission related problem.
When WinZIP is executed, it may need read permission on its own folder and
Read/Write permission on the target folder and system temp folder. And, it
may also access some registry entries during the executing.

You may try two work around for the problem:

1. impersonate the web service with an account in local Administrators
group:

INFO: Implementing Impersonation in an ASP.NET Application
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q306158

2. Running the web serivce still with  Local Service  account and trace the
FileAccess and registry Access with some utilities to see if there is any
access denied error. These utilites called "Filemon" and "Regmon". You can
download them from:

http://www.sysinternals.com/ntw2k/utilities.shtml

Once you found any Access denied in the log, you can grant proper
permission to the Local Service  account  according to the information and
try the web service again.

Hope this help

Luke
Microsoft Online Support

Signature

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Don McNamara - 02 Feb 2004 19:23 GMT
Simon,

That is odd - it does sound like a permission problem.  I would try running
the service as a local admin just too see if greater permission would fix
the problem.

Also, you might want to look at
http://www.icsharpcode.net/OpenSource/SharpZipLib/  It's an open source
library for compressing and decompressing data (zip included) ported from
Java.  It would probably give you a more robust error handling solution.

Good luck,
Don

don.mcnamara@REMOVE.dovestar.com

> Hi
>
[quoted text clipped - 17 lines]
>
> Simon
Elp - 04 Feb 2004 15:37 GMT
Hi,

> The problem I have is that to create the zip file I use Process.Start and
> pass it a string containing the path to winzip and the files to zip as
[quoted text clipped - 5 lines]
> running as the Local Service account so I would have thought that would be
> sufficent permissions.

If your service is running under the local system account (there is no local
service account as far as i know), i doubt that your problem is a permission
problem as this account is a higly privileged account (maybe even more than
the administrator account).

It seems to me that it is a "allow service to interact with desktop"
problem. By default, Windows services are not allowed to have any user
interface or to interact with the current user's desktop. WinZip being a
normal Windows application with a UI, i guess that your service is simply
not allowed to start it unless you check the appropriate check box in your
service's properties. The solution to your problem is maybe as simple as
that.
Pradeep M - 26 Feb 2004 07:03 GMT
HI folks,
 I am facing the same kind of issue. Since, the Service runs in the
context of a non interactive desktop. I have tried setting the service
to interact with the desktop.

But still I dont get the process popping up my desktop.

Below is the source code:

ProcessStartInfo startInfo = new ProcessStartInfo("IExplore.exe");
         
startInfo.WindowStyle = ProcessWindowStyle.Minimized;

startInfo.Arguments = "www.google.com";    
   
Process.Start(startInfo);

I tried running this piece of code under Administrative Rights. But
still i have the same issue..

Prad
Elp - 26 Feb 2004 15:10 GMT
> HI folks,
>   I am facing the same kind of issue. Since, the Service runs in the
> context of a non interactive desktop. I have tried setting the service
> to interact with the desktop.
>
> But still I dont get the process popping up my desktop.

What do you mean by "he Service runs in the context of a non interactive
desktop" ?

If your you try to display something (such as a IE window) from your service
when nobody is logged in Windows, i don't think that you'll see anything
even if the "allow service to interact with desktop" property is set. Unless
maybe if you start messing up with windows stations and all these lovely
things...

If you try to display a IE window while somebody is actually logged in, then
it should work. Are you sure that you restarted your service after setting
the allow interaction with desktop?

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.