By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,918 Members | 1,852 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,918 IT Pros & Developers. It's quick & easy.

Process won't run

P: n/a
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\Pr ocessStuff\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
Mar 22 '06 #1
Share this Question
Share on Google+
16 Replies


P: n/a
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

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


"Caroline" wrote:
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\Pr ocessStuff\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

Mar 22 '06 #2

P: n/a
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
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Caroline" wrote:
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\Pr ocessStuff\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

Mar 22 '06 #3

P: n/a
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.


"Peter Bromberg [C# MVP]" wrote:
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

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


"Caroline" wrote:
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\Pr ocessStuff\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

Mar 23 '06 #4

P: n/a
Correction. The error reads, "No process is associated with this object."

"Caroline" wrote:
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.


"Peter Bromberg [C# MVP]" wrote:
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

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


"Caroline" wrote:
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\Pr ocessStuff\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

Mar 23 '06 #5

P: n/a
Couple ideas here:
1) try doing this the "easy way"

Process.Start("C:\Inetpub\wwwroot\Uniformity\Proce ssStuff\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


"Caroline" wrote:
Correction. The error reads, "No process is associated with this object."

"Caroline" wrote:
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.


"Peter Bromberg [C# MVP]" wrote:
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

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


"Caroline" wrote:

> 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\Pr ocessStuff\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

Mar 23 '06 #6

P: n/a
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.

Mar 24 '06 #7

P: n/a
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.

""Yuan Ren[MSFT]"" wrote:
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.

Mar 24 '06 #8

P: n/a
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.

Mar 27 '06 #9

P: n/a
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.
""Yuan Ren[MSFT]"" wrote:
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.

Apr 3 '06 #10

P: n/a
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.

Apr 4 '06 #11

P: n/a
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" wrote:
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\Pr ocessStuff\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

Apr 6 '06 #12

P: n/a
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" wrote:
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" wrote:
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\Pr ocessStuff\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

Apr 10 '06 #13

P: n/a
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

Apr 11 '06 #14

P: n/a
Hi Yuan,

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

Best,

Caroline

""Yuan Ren[MSFT]"" wrote:
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

Apr 11 '06 #15

P: n/a
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" wrote:
Hi Yuan,

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

Best,

Caroline

""Yuan Ren[MSFT]"" wrote:
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

Apr 12 '06 #16

P: n/a
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.

Apr 14 '06 #17

This discussion thread is closed

Replies have been disabled for this discussion.