Calling an App from ASP.NET

Calling an App from ASP.NET

Post by Stew » Fri, 14 Mar 2003 04:09:30



I want to be able to start an external process (.exe) on
the server in response to some request on a web page
using ASP.NET.  I am trying to use
System.Diagnostics.Process.  This works fine from a
Windows application, I but can't seem to make it work
from an ASP.NET application.  Anyone know why this
doesn't work, and how to make it work?

Thanks

 
 
 

Calling an App from ASP.NET

Post by Steve C. Orr, MCS » Fri, 14 Mar 2003 05:11:22


Make sure your ASPNET user account has the appropriate execute permissions
for the EXE and its resources.

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net


Quote:> I want to be able to start an external process (.exe) on
> the server in response to some request on a web page
> using ASP.NET.  I am trying to use
> System.Diagnostics.Process.  This works fine from a
> Windows application, I but can't seem to make it work
> from an ASP.NET application.  Anyone know why this
> doesn't work, and how to make it work?

> Thanks


 
 
 

Calling an App from ASP.NET

Post by Stew » Fri, 14 Mar 2003 05:32:11


How is this done?  My user is 'Administrator' so don't
believe that there are any restrictions.

- Stew

>-----Original Message-----
>Make sure your ASPNET user account has the appropriate
execute permissions
>for the EXE and its resources.

>--
>I hope this helps,
>Steve C. Orr, MCSD
>http://Steve.Orr.net



>> I want to be able to start an external process (.exe)
on
>> the server in response to some request on a web page
>> using ASP.NET.  I am trying to use
>> System.Diagnostics.Process.  This works fine from a
>> Windows application, I but can't seem to make it work
>> from an ASP.NET application.  Anyone know why this
>> doesn't work, and how to make it work?

>> Thanks

>.

 
 
 

Calling an App from ASP.NET

Post by mark » Fri, 14 Mar 2003 05:52:43


Hi Steve,
I have the same problem.
I tryed this code in various combinations of
CreateNoWindow , RedirectStandardOutput  and
UseShellExecute  :

Dim csc As System.Diagnostics.Process = New
System.Diagnostics.Process()
csc.StartInfo.FileName = "d:\winnt\notepad.exe"
csc.StartInfo.CreateNoWindow = False
csc.StartInfo.UseShellExecute = False
csc.StartInfo.RedirectStandardOutput = True
csc.Start()

Proccess starts but I never get the notepad window
showing, I even tryed old VB Shell with same result.
Is it possible to open .exe file so it can be interacted
with?

Thanks
Mark

>-----Original Message-----
>Make sure your ASPNET user account has the appropriate
execute permissions
>for the EXE and its resources.

>--
>I hope this helps,
>Steve C. Orr, MCSD
>http://Steve.Orr.net



>> I want to be able to start an external process (.exe) on
>> the server in response to some request on a web page
>> using ASP.NET.  I am trying to use
>> System.Diagnostics.Process.  This works fine from a
>> Windows application, I but can't seem to make it work
>> from an ASP.NET application.  Anyone know why this
>> doesn't work, and how to make it work?

>> Thanks

>.

 
 
 

Calling an App from ASP.NET

Post by bruce barke » Fri, 14 Mar 2003 06:12:25


you cannot start windows apps from asp.net, as the process will not have
permission to the desktop. you can only run console apps.

-- bruce (sqlwork.com)


> Hi Steve,
> I have the same problem.
> I tryed this code in various combinations of
> CreateNoWindow , RedirectStandardOutput  and
> UseShellExecute  :

> Dim csc As System.Diagnostics.Process = New
> System.Diagnostics.Process()
> csc.StartInfo.FileName = "d:\winnt\notepad.exe"
> csc.StartInfo.CreateNoWindow = False
> csc.StartInfo.UseShellExecute = False
> csc.StartInfo.RedirectStandardOutput = True
> csc.Start()

> Proccess starts but I never get the notepad window
> showing, I even tryed old VB Shell with same result.
> Is it possible to open .exe file so it can be interacted
> with?

> Thanks
> Mark

> >-----Original Message-----
> >Make sure your ASPNET user account has the appropriate
> execute permissions
> >for the EXE and its resources.

> >--
> >I hope this helps,
> >Steve C. Orr, MCSD
> >http://Steve.Orr.net



> >> I want to be able to start an external process (.exe) on
> >> the server in response to some request on a web page
> >> using ASP.NET.  I am trying to use
> >> System.Diagnostics.Process.  This works fine from a
> >> Windows application, I but can't seem to make it work
> >> from an ASP.NET application.  Anyone know why this
> >> doesn't work, and how to make it work?

> >> Thanks

> >.

 
 
 

Calling an App from ASP.NET

Post by Steve C. Orr, MCS » Fri, 14 Mar 2003 06:15:53


You won't see any UI appear for the app, because it's not running on the
same desktop as you.
In a production environment this doesn't even make sense anyway because
nobody would be sitting at the server when the UI appeared there.

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net


> Hi Steve,
> I have the same problem.
> I tryed this code in various combinations of
> CreateNoWindow , RedirectStandardOutput  and
> UseShellExecute  :

> Dim csc As System.Diagnostics.Process = New
> System.Diagnostics.Process()
> csc.StartInfo.FileName = "d:\winnt\notepad.exe"
> csc.StartInfo.CreateNoWindow = False
> csc.StartInfo.UseShellExecute = False
> csc.StartInfo.RedirectStandardOutput = True
> csc.Start()

> Proccess starts but I never get the notepad window
> showing, I even tryed old VB Shell with same result.
> Is it possible to open .exe file so it can be interacted
> with?

> Thanks
> Mark

> >-----Original Message-----
> >Make sure your ASPNET user account has the appropriate
> execute permissions
> >for the EXE and its resources.

> >--
> >I hope this helps,
> >Steve C. Orr, MCSD
> >http://Steve.Orr.net



> >> I want to be able to start an external process (.exe) on
> >> the server in response to some request on a web page
> >> using ASP.NET.  I am trying to use
> >> System.Diagnostics.Process.  This works fine from a
> >> Windows application, I but can't seem to make it work
> >> from an ASP.NET application.  Anyone know why this
> >> doesn't work, and how to make it work?

> >> Thanks

> >.

 
 
 

Calling an App from ASP.NET

Post by mark » Fri, 14 Mar 2003 06:35:08


Thanks for response.
Application that I want to start will run ~10-15 hours. I
wanted to give to a person ability to check on it or close
it.
Proccess that I open from asp.net I can't close from Task
Manager.
Is there a way to interact with it?
May be open one proccess from asp.net and from it open
another one?

Thanks
Mark

>-----Original Message-----
>You won't see any UI appear for the app, because it's not
running on the
>same desktop as you.
>In a production environment this doesn't even make sense
anyway because
>nobody would be sitting at the server when the UI
appeared there.

>--
>I hope this helps,
>Steve C. Orr, MCSD
>http://Steve.Orr.net



>> Hi Steve,
>> I have the same problem.
>> I tryed this code in various combinations of
>> CreateNoWindow , RedirectStandardOutput  and
>> UseShellExecute  :

>> Dim csc As System.Diagnostics.Process = New
>> System.Diagnostics.Process()
>> csc.StartInfo.FileName = "d:\winnt\notepad.exe"
>> csc.StartInfo.CreateNoWindow = False
>> csc.StartInfo.UseShellExecute = False
>> csc.StartInfo.RedirectStandardOutput = True
>> csc.Start()

>> Proccess starts but I never get the notepad window
>> showing, I even tryed old VB Shell with same result.
>> Is it possible to open .exe file so it can be interacted
>> with?

>> Thanks
>> Mark

>> >-----Original Message-----
>> >Make sure your ASPNET user account has the appropriate
>> execute permissions
>> >for the EXE and its resources.

>> >--
>> >I hope this helps,
>> >Steve C. Orr, MCSD
>> >http://Steve.Orr.net



>> >> I want to be able to start an external process
(.exe) on
>> >> the server in response to some request on a web page
>> >> using ASP.NET.  I am trying to use
>> >> System.Diagnostics.Process.  This works fine from a
>> >> Windows application, I but can't seem to make it work
>> >> from an ASP.NET application.  Anyone know why this
>> >> doesn't work, and how to make it work?

>> >> Thanks

>> >.

>.

 
 
 

Calling an App from ASP.NET

Post by Steve C. Orr, MCS » Fri, 14 Mar 2003 06:41:27


You might consider using a windows service service for this long running app
that you speak of.

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net


> Thanks for response.
> Application that I want to start will run ~10-15 hours. I
> wanted to give to a person ability to check on it or close
> it.
> Proccess that I open from asp.net I can't close from Task
> Manager.
> Is there a way to interact with it?
> May be open one proccess from asp.net and from it open
> another one?

> Thanks
> Mark

> >-----Original Message-----
> >You won't see any UI appear for the app, because it's not
> running on the
> >same desktop as you.
> >In a production environment this doesn't even make sense
> anyway because
> >nobody would be sitting at the server when the UI
> appeared there.

> >--
> >I hope this helps,
> >Steve C. Orr, MCSD
> >http://Steve.Orr.net



> >> Hi Steve,
> >> I have the same problem.
> >> I tryed this code in various combinations of
> >> CreateNoWindow , RedirectStandardOutput  and
> >> UseShellExecute  :

> >> Dim csc As System.Diagnostics.Process = New
> >> System.Diagnostics.Process()
> >> csc.StartInfo.FileName = "d:\winnt\notepad.exe"
> >> csc.StartInfo.CreateNoWindow = False
> >> csc.StartInfo.UseShellExecute = False
> >> csc.StartInfo.RedirectStandardOutput = True
> >> csc.Start()

> >> Proccess starts but I never get the notepad window
> >> showing, I even tryed old VB Shell with same result.
> >> Is it possible to open .exe file so it can be interacted
> >> with?

> >> Thanks
> >> Mark

> >> >-----Original Message-----
> >> >Make sure your ASPNET user account has the appropriate
> >> execute permissions
> >> >for the EXE and its resources.

> >> >--
> >> >I hope this helps,
> >> >Steve C. Orr, MCSD
> >> >http://Steve.Orr.net



> >> >> I want to be able to start an external process
> (.exe) on
> >> >> the server in response to some request on a web page
> >> >> using ASP.NET.  I am trying to use
> >> >> System.Diagnostics.Process.  This works fine from a
> >> >> Windows application, I but can't seem to make it work
> >> >> from an ASP.NET application.  Anyone know why this
> >> >> doesn't work, and how to make it work?

> >> >> Thanks

> >> >.

> >.

 
 
 

Calling an App from ASP.NET

Post by mark » Fri, 14 Mar 2003 07:19:02


I thought about service.
But there can be 2 or even 3 instances of this application
running at the same time.
Can I run more then 1 service from the same exe file?

Thanks
Mark

Quote:>-----Original Message-----
>You might consider using a windows service service for

this long running app
>that you speak of.

>--
>I hope this helps,
>Steve C. Orr, MCSD
>http://Steve.Orr.net



>> Thanks for response.
>> Application that I want to start will run ~10-15 hours.
I
>> wanted to give to a person ability to check on it or
close
>> it.
>> Proccess that I open from asp.net I can't close from
Task
>> Manager.
>> Is there a way to interact with it?
>> May be open one proccess from asp.net and from it open
>> another one?

>> Thanks
>> Mark

>> >-----Original Message-----
>> >You won't see any UI appear for the app, because it's
not
>> running on the
>> >same desktop as you.
>> >In a production environment this doesn't even make
sense
>> anyway because
>> >nobody would be sitting at the server when the UI
>> appeared there.

>> >--
>> >I hope this helps,
>> >Steve C. Orr, MCSD
>> >http://Steve.Orr.net



>> >> Hi Steve,
>> >> I have the same problem.
>> >> I tryed this code in various combinations of
>> >> CreateNoWindow , RedirectStandardOutput  and
>> >> UseShellExecute  :

>> >> Dim csc As System.Diagnostics.Process = New
>> >> System.Diagnostics.Process()
>> >> csc.StartInfo.FileName = "d:\winnt\notepad.exe"
>> >> csc.StartInfo.CreateNoWindow = False
>> >> csc.StartInfo.UseShellExecute = False
>> >> csc.StartInfo.RedirectStandardOutput = True
>> >> csc.Start()

>> >> Proccess starts but I never get the notepad window
>> >> showing, I even tryed old VB Shell with same result.
>> >> Is it possible to open .exe file so it can be
interacted
>> >> with?

>> >> Thanks
>> >> Mark

>> >> >-----Original Message-----
>> >> >Make sure your ASPNET user account has the
appropriate
>> >> execute permissions
>> >> >for the EXE and its resources.

>> >> >--
>> >> >I hope this helps,
>> >> >Steve C. Orr, MCSD
>> >> >http://Steve.Orr.net



>> >> >> I want to be able to start an external process
>> (.exe) on
>> >> >> the server in response to some request on a web
page
>> >> >> using ASP.NET.  I am trying to use
>> >> >> System.Diagnostics.Process.  This works fine from
a
>> >> >> Windows application, I but can't seem to make it
work
>> >> >> from an ASP.NET application.  Anyone know why this
>> >> >> doesn't work, and how to make it work?

>> >> >> Thanks

>> >> >.

>> >.

>.

 
 
 

Calling an App from ASP.NET

Post by Steve C. Orr, MCS » Fri, 14 Mar 2003 08:21:53


Well you could certainly spawn individual threads in your web service to
have it do more than one task at once.

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net


> I thought about service.
> But there can be 2 or even 3 instances of this application
> running at the same time.
> Can I run more then 1 service from the same exe file?

> Thanks
> Mark

> >-----Original Message-----
> >You might consider using a windows service service for
> this long running app
> >that you speak of.

> >--
> >I hope this helps,
> >Steve C. Orr, MCSD
> >http://Steve.Orr.net



> >> Thanks for response.
> >> Application that I want to start will run ~10-15 hours.
> I
> >> wanted to give to a person ability to check on it or
> close
> >> it.
> >> Proccess that I open from asp.net I can't close from
> Task
> >> Manager.
> >> Is there a way to interact with it?
> >> May be open one proccess from asp.net and from it open
> >> another one?

> >> Thanks
> >> Mark

> >> >-----Original Message-----
> >> >You won't see any UI appear for the app, because it's
> not
> >> running on the
> >> >same desktop as you.
> >> >In a production environment this doesn't even make
> sense
> >> anyway because
> >> >nobody would be sitting at the server when the UI
> >> appeared there.

> >> >--
> >> >I hope this helps,
> >> >Steve C. Orr, MCSD
> >> >http://Steve.Orr.net



> >> >> Hi Steve,
> >> >> I have the same problem.
> >> >> I tryed this code in various combinations of
> >> >> CreateNoWindow , RedirectStandardOutput  and
> >> >> UseShellExecute  :

> >> >> Dim csc As System.Diagnostics.Process = New
> >> >> System.Diagnostics.Process()
> >> >> csc.StartInfo.FileName = "d:\winnt\notepad.exe"
> >> >> csc.StartInfo.CreateNoWindow = False
> >> >> csc.StartInfo.UseShellExecute = False
> >> >> csc.StartInfo.RedirectStandardOutput = True
> >> >> csc.Start()

> >> >> Proccess starts but I never get the notepad window
> >> >> showing, I even tryed old VB Shell with same result.
> >> >> Is it possible to open .exe file so it can be
> interacted
> >> >> with?

> >> >> Thanks
> >> >> Mark

> >> >> >-----Original Message-----
> >> >> >Make sure your ASPNET user account has the
> appropriate
> >> >> execute permissions
> >> >> >for the EXE and its resources.

> >> >> >--
> >> >> >I hope this helps,
> >> >> >Steve C. Orr, MCSD
> >> >> >http://Steve.Orr.net



> >> >> >> I want to be able to start an external process
> >> (.exe) on
> >> >> >> the server in response to some request on a web
> page
> >> >> >> using ASP.NET.  I am trying to use
> >> >> >> System.Diagnostics.Process.  This works fine from
> a
> >> >> >> Windows application, I but can't seem to make it
> work
> >> >> >> from an ASP.NET application.  Anyone know why this
> >> >> >> doesn't work, and how to make it work?

> >> >> >> Thanks

> >> >> >.

> >> >.

> >.

 
 
 

Calling an App from ASP.NET

Post by Stew » Fri, 14 Mar 2003 23:54:02


Mark,

I think I have a good solution.  I posted the original
message and have been looking for a solution.

Instead of calling your executable directly from ASP.NET
for which it just doesn't work the way you want it to,
write a tiny polling program that checks say, once a
second, for the existance of a certain file placed in
some directory.  When it finds this file, it launches
your executable.  The responsibility of your ASP.NET
program is now to create this file.  You can even pass
parameters to your polling program through this file.  
The polling program should of course delete this file as
soon as it's done with it.

This works great for me and is exactly what I need.  What
do you think?

- Stew

>-----Original Message-----
>I thought about service.
>But there can be 2 or even 3 instances of this
application
>running at the same time.
>Can I run more then 1 service from the same exe file?

>Thanks
>Mark

>>-----Original Message-----
>>You might consider using a windows service service for
>this long running app
>>that you speak of.

>>--
>>I hope this helps,
>>Steve C. Orr, MCSD
>>http://Steve.Orr.net



>>> Thanks for response.
>>> Application that I want to start will run ~10-15
hours.
>I
>>> wanted to give to a person ability to check on it or
>close
>>> it.
>>> Proccess that I open from asp.net I can't close from
>Task
>>> Manager.
>>> Is there a way to interact with it?
>>> May be open one proccess from asp.net and from it open
>>> another one?

>>> Thanks
>>> Mark

>>> >-----Original Message-----
>>> >You won't see any UI appear for the app, because
it's
>not
>>> running on the
>>> >same desktop as you.
>>> >In a production environment this doesn't even make
>sense
>>> anyway because
>>> >nobody would be sitting at the server when the UI
>>> appeared there.

>>> >--
>>> >I hope this helps,
>>> >Steve C. Orr, MCSD
>>> >http://Steve.Orr.net



>>> >> Hi Steve,
>>> >> I have the same problem.
>>> >> I tryed this code in various combinations of
>>> >> CreateNoWindow , RedirectStandardOutput  and
>>> >> UseShellExecute  :

>>> >> Dim csc As System.Diagnostics.Process = New
>>> >> System.Diagnostics.Process()
>>> >> csc.StartInfo.FileName = "d:\winnt\notepad.exe"
>>> >> csc.StartInfo.CreateNoWindow = False
>>> >> csc.StartInfo.UseShellExecute = False
>>> >> csc.StartInfo.RedirectStandardOutput = True
>>> >> csc.Start()

>>> >> Proccess starts but I never get the notepad window
>>> >> showing, I even tryed old VB Shell with same
result.
>>> >> Is it possible to open .exe file so it can be
>interacted
>>> >> with?

>>> >> Thanks
>>> >> Mark

>>> >> >-----Original Message-----
>>> >> >Make sure your ASPNET user account has the
>appropriate
>>> >> execute permissions
>>> >> >for the EXE and its resources.

>>> >> >--
>>> >> >I hope this helps,
>>> >> >Steve C. Orr, MCSD
>>> >> >http://Steve.Orr.net



>>> >> >> I want to be able to start an external process
>>> (.exe) on
>>> >> >> the server in response to some request on a web
>page
>>> >> >> using ASP.NET.  I am trying to use
>>> >> >> System.Diagnostics.Process.  This works fine
from
>a
>>> >> >> Windows application, I but can't seem to make
it
>work
>>> >> >> from an ASP.NET application.  Anyone know why
this
>>> >> >> doesn't work, and how to make it work?

>>> >> >> Thanks

>>> >> >.

>>> >.

>>.

>.

 
 
 

1. Debug problem, ASP.NET app calling a web service

I have a debug problem with the released beta 2. I'm debugging a web
application. I'm using IE6, released version (not the pre-release IE6 that
comes on the VS.NET CD).

I can debug the ASP.NET application fine until I get to a web service that
the ASP.NET application calls. I've tried it when the web service being
called is on my machine, and when the web service being called is on another
machine. In either case, the app works fine when it's running.

When it's in debug mode, I can debug it just fine. Until my code calls an
object which calls a web service.

Then it hangs. Eventually I _may_ get a popup box that says: "An unhandled
exception of type
'System.AppDomainUnloadedException' occurred in Unknown Module." Then I get
another popup box that says: "There is no source code available for the
current location". Then I have to stop the debug.

Any idea why it's hanging on (apparently) the web service call?

2. Cat3100 console access

3. Debug question, ASP.NET app calling web services

4. Can calulator watches do trig functions yet?

5. Advantages of Windows App over ASP.NET App.

6. fatal exception OD

7. NEED help converting ASP/COM+ App to .NET (Especially ASP to ASP.NET)!!!!

8. Creating bootable tapes for Digital UNIX V4.0?

9. VB6 App to VB.NET to ASP.NET

10. Can't run ASP.NET apps after upgrading to release of VS.NET

11. ASP.NET app created using text editor - how to migrate to VS.NET?

12. VS.NET 2003 - How to upgrade ASP.NET apps?