Process won't run

G

Guest

I am building a web application to gather user information then launch a
process to calculate results. The process is a 3rd Party executable. I
cannot get the process to start. Is there a problem with this code?

Public Overloads Shared Function StartApplication(ByVal fileName As String,
ByVal myPath As String) As Process
Try
Dim WtDistrib As New Process
WtDistrib.StartInfo.Verb = "Execute"
WtDistrib.StartInfo.CreateNoWindow = True
Dim SI As New
ProcessStartInfo("C:\Inetpub\wwwroot\Uniformity\ProcessStuff\WtDistrib.exe")
WtDistrib.Start(SI)
WtDistrib.WaitForExit()
Console.WriteLine(WtDistrib.ExitCode)
Console.WriteLine("WtDistrib.exe was closed at: " &
WtDistrib.ExitTime & ".")
WtDistrib.Close()

Catch e As Exception
Debug.Write("Error: " + e.Message)
Console.WriteLine("The following exception was raised: " +
e.Message)
End Try

End Function
 
G

Guest

Don't use Console.WriteLine in a method that's supposed to work in an ASP.NET
web app.
You could use System.Diagnostics.Debug.WriteLine if you want.
Peter
 
G

Guest

Caroline,
Why is the return type from this method "Process"? That doesn't make sense.
There shouldn't be a return type (or if there is , perhaps boolean for
success, I suppose).

Have you stepped through your code in the debugger? What happens when you do?

Peter
 
G

Guest

I dropped the Process return type.

When I step through, an exception is thrown at

WtDistrib.WaitForExit()

"No thread is associated with this process."

The example I posted is only one of several that I have tried. This is my
first asp.net application.
 
G

Guest

Couple ideas here:
1) try doing this the "easy way"

Process.Start("C:\Inetpub\wwwroot\Uniformity\ProcessStuff\WtDistrib.exe")

If that doesn't work, you may have a permissions issue. ASP.NET by default
runs under weak credentials. You could add
<identity impersonate="true" userName="strongaccountname" password = "pass" />
to the web.config.

Where "strongaccountname" is an account that you know has permission to
execute in the respective directory.

Hope that helps,
Peter


--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
 
Y

Yuan Ren[MSFT]

Hi Caroline,

Thanks for posting!

As Peter mentioned, you can use the impersonation for the current ASP.NET
application. There is a KB article from Microsoft support site demonstrates
how to approach this. Please follow the link below:
http://support.microsoft.com/kb/306158/en-us/

Hope this will be helpful!

Regards,

Yuan Ren
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Thank you. Your input was very helpful.

I had tried impersonation, but I am developping in a Windows 2000
environment, which explains why I failed. It is good to know that
impersonation WILL work though.

I will move my project to the 2003 Server today and see if I have more luck
with impersonation there.
 
Y

Yuan Ren[MSFT]

Hi Caroline,

Thanks for your reply!

From your description, I have a little confusion about the current issue.
You said "which explains why I failed". My understanding for this is that
you use the impersonation on Windows 2000 is failed. If I have
misunderstood anything, please let me know.

In my opinion, the impersonation is not for the specific environment. Both
Windows 2000 and Windows 2003 are appropriated for the current issue. So,
if the application runs well under the impersonation on Windows 2000, I
think it also runs well on Windows 2003.

In addition, I'll look forward your reply. Please don't hesitate to let me
know the result. It's my pleasure to be assistance.

Regards,

Yuan Ren
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

The process will not run on the 2003 server either.

I can write to an input file in the directory, but the exe never runs.
 
Y

Yuan Ren[MSFT]

Hi Caroline,

Thanks for your reply!

At the current stage, is there any related information for the specific
issue? Please feel free to attach the info here when you find any clues.

Regards,

Yuan Ren
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

I get the error: "No thread is associated with this process" along with the
following:

The thread 'Win32 Thread' (0xbe0) has exited with code 0 (0x0).
Error: No process is associated with this object.The thread 'Win32 Thread'
(0xaf4) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x624) has exited with code 0 (0x0).
The thread '<No Name>' (0xaf4) has exited with code 0 (0x0).
The thread '<No Name>' (0xae8) has exited with code 0 (0x0).
The thread '<No Name>' (0xbe0) has exited with code 0 (0x0).
The thread '<No Name>' (0xbfc) has exited with code 0 (0x0).
The thread '<No Name>' (0xc04) has exited with code 0 (0x0).
The thread 'Thread 6C0' (0x6c0) has exited with code 0 (0x0).
The program '[2048] IEXPLORE.EXE: Script program' has exited with code 0
(0x0).
The program '[2864] aspnet_wp.exe: Native' has exited with code 0 (0x0).
The program '[2864] aspnet_wp.exe:
/LM/W3SVC/1/Root/Uniformity-2-127888238045678631' has exited with code 0
(0x0).
The program '[2864] aspnet_wp.exe: DefaultDomain' has exited with code 0
(0x0).
 
G

Guest

I impersonated my own account (in test) and still can't run the process from
IE.
I am able to write to a file in the same directory from my web application.
I can view a graph from the same directory.

I can run the process from command line, and from Program Files.

Caroline said:
I get the error: "No thread is associated with this process" along with the
following:

The thread 'Win32 Thread' (0xbe0) has exited with code 0 (0x0).
Error: No process is associated with this object.The thread 'Win32 Thread'
(0xaf4) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x624) has exited with code 0 (0x0).
The thread '<No Name>' (0xaf4) has exited with code 0 (0x0).
The thread '<No Name>' (0xae8) has exited with code 0 (0x0).
The thread '<No Name>' (0xbe0) has exited with code 0 (0x0).
The thread '<No Name>' (0xbfc) has exited with code 0 (0x0).
The thread '<No Name>' (0xc04) has exited with code 0 (0x0).
The thread 'Thread 6C0' (0x6c0) has exited with code 0 (0x0).
The program '[2048] IEXPLORE.EXE: Script program' has exited with code 0
(0x0).
The program '[2864] aspnet_wp.exe: Native' has exited with code 0 (0x0).
The program '[2864] aspnet_wp.exe:
/LM/W3SVC/1/Root/Uniformity-2-127888238045678631' has exited with code 0
(0x0).
The program '[2864] aspnet_wp.exe: DefaultDomain' has exited with code 0
(0x0).




Caroline said:
I am building a web application to gather user information then launch a
process to calculate results. The process is a 3rd Party executable. I
cannot get the process to start. Is there a problem with this code?

Public Overloads Shared Function StartApplication(ByVal fileName As String,
ByVal myPath As String) As Process
Try
Dim WtDistrib As New Process
WtDistrib.StartInfo.Verb = "Execute"
WtDistrib.StartInfo.CreateNoWindow = True
Dim SI As New
ProcessStartInfo("C:\Inetpub\wwwroot\Uniformity\ProcessStuff\WtDistrib.exe")
WtDistrib.Start(SI)
WtDistrib.WaitForExit()
Console.WriteLine(WtDistrib.ExitCode)
Console.WriteLine("WtDistrib.exe was closed at: " &
WtDistrib.ExitTime & ".")
WtDistrib.Close()

Catch e As Exception
Debug.Write("Error: " + e.Message)
Console.WriteLine("The following exception was raised: " +
e.Message)
End Try

End Function
 
Y

Yuan Ren[MSFT]

Hi Caroline,

Thanks for your reply!

For the current issue, from your information, all thread is quit normally.
The "0x0" means the program runs and terminates well. So, I think if you
want to run process with UI in the web application. This is unavailable for
the web application since system design. This means the system doesn't
allow you run process in the web application. However, if you want to call
other commands such as the "netstat" command, the command will be executed
correctly.

Hope this will be helpful!

Regards,

Yuan Ren
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights
 
G

Guest

Hi Yuan,

Thank you very much. I will follow your advice and try this today!

Best,

Caroline
 
G

Guest

My options are:

1. Download the exe to the client and have the user run it from there?

OR

2. Skip the exe and write the functionality into the web application itself?

An exe cannot be run from a Web Application UI?

I appreciate your help a lot.

Caroline



Caroline said:
Hi Yuan,

Thank you very much. I will follow your advice and try this today!

Best,

Caroline

"Yuan Ren[MSFT]" said:
Hi Caroline,

Thanks for your reply!

For the current issue, from your information, all thread is quit normally.
The "0x0" means the program runs and terminates well. So, I think if you
want to run process with UI in the web application. This is unavailable for
the web application since system design. This means the system doesn't
allow you run process in the web application. However, if you want to call
other commands such as the "netstat" command, the command will be executed
correctly.

Hope this will be helpful!

Regards,

Yuan Ren
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights
 
Y

Yuan Ren[MSFT]

Hi Caroline,

Thanks for your reply!

From your description, my understanding is that you want to start a process
in the client site by the ASP.NET application. If I have misunderstood
anything, please let me know.

Actually, if you start a process in the ASP.NET application, the process is
started in the server side. This means you can find the process in the web
server machine. However, the process can not be started in the client side
since the ASP.NET is the server application. If you want to implement some
functionality like starting a process in the client side, I recommend you
use the ActiveX control for the current web application. And then, the
process will be started when the use accept the ActiveX control.

Hope this will be helpful!

Regards,

Yuan Ren
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top