473,395 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Trouble starting process from IIS

Inside a HttpHandler I'm trying to spawn an EXE (console app).
Although it shows up in the process list, it doesn't seem to do
anything. (And even if I specify ProcessWindowStyle.Normal, it doesn't
show the cmd.exe box.) I've tried with and without UseShellExecute, and
even using "cmd.exe /c myprog.exe myargs..."
Launching the process from a seperate project (not IIS) seems to work
fine.
Is this a permissions issue? (Though as I said, it does actually start
the process.) Any thougts?

thanks,
mike

Nov 19 '05 #1
8 2029
Your web application has no concept of a desktop, so has no where to create
your exe window.

When you spawn exe's from asp.net you have to ensure they have no window -
or setup your web system to run as a user with a profile somehow.......time
for some fishing about on google methinks.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Mike" <vi********@yahoo.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Inside a HttpHandler I'm trying to spawn an EXE (console app).
Although it shows up in the process list, it doesn't seem to do
anything. (And even if I specify ProcessWindowStyle.Normal, it doesn't
show the cmd.exe box.) I've tried with and without UseShellExecute, and
even using "cmd.exe /c myprog.exe myargs..."
Launching the process from a seperate project (not IIS) seems to work
fine.
Is this a permissions issue? (Though as I said, it does actually start
the process.) Any thougts?

thanks,
mike

Nov 19 '05 #2
Well, I don't *want* the window (I want it hidden anyway, I was just
using Normal as a debugging aid, which appears to have been misguided).

I want the app for its side-effect (creating some files) -- If there's
any stdio in this app., I'm free to ignore it.
Are you saying it should be a WinForm app with no .Show, as opposed to
a console app. which as a by-product creates a dos-box?
(I don't have the source at the moment.)
BTW, I did RTFM and Google before posting and didn't see much, though I
could have missed something -- if you have specified pointers, please
let me know.

thanks

Nov 19 '05 #3
BTW, it also turns out that the EXE creates a (hidden) IE control
instance to do it's work.
So, even if I don't use and EXE and code what's in the EXE directly in
code-behind, is that going to be an issue becuase the IE control has
hidden windows and expects an event loop even when hidden?

Nov 19 '05 #4
I found this, which doesn't look promising:

"Don Kiely recently pointed to an article on CodeProject with C# code
to run a process in a new security context. The code PInvokes
CreateProcessWithLogonW, but doesn't work under ASP.NET.

CreateProcessWithLogonW is one of those tricky APIs that doesn't pick
up and move well from one environment to the next. Unfortunately, there
is no way with .NET 1.1 to start a new process under alternate
credentials without PInvoke. A spawned process always inherits the
token of the creator process, so even if a thread is impersonating when
it calls Process.Start, the new process always has the same identity of
the current process. The good news is that Microsoft makes it easy in
..NET 2.0. "

I can't beleive this isn't a solved problem...

Nov 19 '05 #5
Hi Mike:

I can't beleive this isn't a solved problem...


It is sort of a rare problem. Did we talk before about this topic? I
seem to remember pointing you to some code.

--
Scott
http://www.OdeToCode.com/blogs/scott/

Nov 19 '05 #6
Actually, I forgot to post the KB article:
http://support.microsoft.com/default...b;EN-US;889251

--
Scott
http://www.OdeToCode.com/blogs/scott/

On 10 Mar 2005 15:41:36 -0800, "Mike" <vi********@yahoo.com> wrote:
I found this, which doesn't look promising:

"Don Kiely recently pointed to an article on CodeProject with C# code
to run a process in a new security context. The code PInvokes
CreateProcessWithLogonW, but doesn't work under ASP.NET.

CreateProcessWithLogonW is one of those tricky APIs that doesn't pick
up and move well from one environment to the next. Unfortunately, there
is no way with .NET 1.1 to start a new process under alternate
credentials without PInvoke. A spawned process always inherits the
token of the creator process, so even if a thread is impersonating when
it calls Process.Start, the new process always has the same identity of
the current process. The good news is that Microsoft makes it easy in
.NET 2.0. "

I can't beleive this isn't a solved problem...


Nov 19 '05 #7
No, I don't think you've helped me with this before...
Why is it always the "rare" problems that appear after only 10 lines of
code?...

This article you pointed me to seems similar, but not identical, to:
http://support.microsoft.com/?id=306158
Which didn't work. (The loginAsUser called failed -- but it could be
becuase my test machine in not part of any domain.)
I'll give this a try.

I'm thinking about switching gears completely, and instead of launching
a process from IIS doing the following: Adding a entry to a SQL server
table which is a command queue, then having one-of-N macines remove an
entry, spawn the worker process, and stick results back on the
filesystem of the requesting machine, and having the server continue
after the file is ready. This way the IIS processes doesn't have to
start a process or access an external file -- the worker machine writes
back to the server. (Sounds like a good candidate for Asp.net 2.0 async
pages when they are available.)
Do you see any problems with this plan? Does remote resource access
needing delegation only appear for a \\share\dirve, or does a
letter-mounted drive appear still count as "remote"?

thanks,
m

Nov 19 '05 #8
On 15 Mar 2005 14:31:33 -0800, "Mike" <vi********@yahoo.com> wrote:
No, I don't think you've helped me with this before...
Why is it always the "rare" problems that appear after only 10 lines of
code?...

This article you pointed me to seems similar, but not identical, to:
http://support.microsoft.com/?id=306158
Which didn't work. (The loginAsUser called failed -- but it could be
becuase my test machine in not part of any domain.)
I'll give this a try.

I'm thinking about switching gears completely, and instead of launching
a process from IIS doing the following: Adding a entry to a SQL server
table which is a command queue, then having one-of-N macines remove an
entry, spawn the worker process, and stick results back on the
filesystem of the requesting machine, and having the server continue
after the file is ready. This way the IIS processes doesn't have to
start a process or access an external file -- the worker machine writes
back to the server. (Sounds like a good candidate for Asp.net 2.0 async
pages when they are available.)
Do you see any problems with this plan? Does remote resource access
needing delegation only appear for a \\share\dirve, or does a
letter-mounted drive appear still count as "remote"?


Yes, a mapped drive will still appear as remote - what's worse is
mapped drives aren't loaded for most background processes and service
- only for the interactive user.

Switching gears once again - how about running in a COM+ server
package. There you can run with a fixed identity easily by deriving
from ServicedComponent.

--
Scott
http://www.OdeToCode.com/blogs/scott/

Nov 19 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: JW | last post by:
Hi, I don't seem to get any results from the following use of Runtime.getRuntime().exec(cmd) using Java 1.4 on Redhat linux. Suppose that in the same directory as my java file below, I have...
12
by: serge calderara | last post by:
Dear all, I have an application which is suppose to start another executable process. As soon as that process is running, I need to retrive its handle. The problem of the particular process I am...
12
by: Winbatch | last post by:
Hi, I'm trying to learn multithreading and it doesn't seem to be working for me. I have a feeling it has to do with the fact that I'm writing to files rather than to printf, but maybe not. ...
3
by: Christopher | last post by:
One of our ASP.NET Pages is starting a new Process using the Process object. When the process starts, it is started under the ASPNET User. We tried editing the web.config file and the...
6
by: Daniel Walzenbach | last post by:
Hi, I have a web application which sometimes throws an “out of memory” exception. To get an idea what happens I traced some values using performance monitor and got the following values (for...
0
by: Mark Henry | last post by:
I wrote a Desktop class for manipulating desktops and window stations. The class is being used by a service for starting applications on the interactive desktop (the service cannot run as Local...
8
by: cypher543 | last post by:
This has been driving me insane for the last hour or so. I have search everywhere, and nothing works. I am trying to use the subprocess module to run a program and get its output line by line. But,...
4
by: JamesB | last post by:
Hi, I need to trap a particular process starting or ending. I have done this using process.start from within my own app, but powers that be really want it to be seperate (i.e. my app should...
1
by: ropo | last post by:
I have a .NET 2.0 app that at one point starts an old MFC App through System.Diagnostics.Process.Start from a model form/ I then wait for it to finish by calling StartedProcess.WaitForExit(); ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.