473,587 Members | 2,324 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 ProcessWindowSt yle.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 2048
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.......t ime
for some fishing about on google methinks.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Mike" <vi********@yah oo.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.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 ProcessWindowSt yle.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
CreateProcessWi thLogonW, but doesn't work under ASP.NET.

CreateProcessWi thLogonW 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********@yah oo.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
CreateProcessW ithLogonW, but doesn't work under ASP.NET.

CreateProcessW ithLogonW 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********@yah oo.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 ServicedCompone nt.

--
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
40461
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 files junk1, junk2, junk3, and i want to have the java program delete all of these files.
12
2906
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 starting is that it has a welcome window first which gets displayed and then the real windows after a while,in other words it means that the...
12
2108
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. Basically, I wanted to see if it would be faster to write to 4 files at the same time (parallel) rather than 4 in a row (serially). however, when my...
3
1955
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 machine.config to operate under other user accounts but our dynamically started process still starts under ASPNET. How do you programatically start a process...
6
3777
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 one day): \\FFDS24\ASP.NET Applications(_LM_W3SVC_1_Root_ATV2004)\Errors During Execution: 7 \\FFDS24\ASP.NET Apps...
0
1452
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 System, so it doesn't inherently have access to the interactive desktop). A simple launcher application gives the service access to the interactive...
8
6511
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, it always waits for the process to terminate and then return the output all at once. Can someone please show me some code that actually works for...
4
2541
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 actually be a service, and not require the other process starting from within my own program). Fair enough - what's the best way? My initial thought...
1
1846
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(); Problem is: When I close the MFC app if there is an window behind my .NET app it will come to the front leaving my .NET app at the back.
0
7843
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8206
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8340
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7967
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6621
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3840
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2353
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.