473,387 Members | 3,684 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,387 software developers and data experts.

Process won't run

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
16 2116
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: haptiK | last post by:
Hello, can i use php to multithread mail() or something similar? in my company i need to send multiple copies of email to a few hundred ppl affilated and on my list. instead of calling mail...
21
by: John Lin | last post by:
Howdy, I want to know how to tell if a forked process is done. Actually, my real question is that I want to run a shell script inside of a python script, and after the shell script has...
5
by: Natan | last post by:
Hi. I have a python script under linux where I poll many hundreds of interfaces with mrtg every 5 minutes. Today I create some threads and use os.system(command) to run the process, but some of...
0
by: Patrick A. | last post by:
Dll written in VB.NET 2003 to start a command remotely. You can : - launch the command and wait until it's finished. (Ex. 1) - launch the command providing a timeout in seconds, it will wait...
2
by: David | last post by:
I'm opening a cmd window to run an ftp process. It's easy enough to close the process (.close()), but the cmd window won't close unless I go out to the window and type 'quit'. How can I send a...
6
by: quamis | last post by:
Hy, i need to process every character in a file, so i open the file read in buffers of about 8192bytes and process each buffer, then i write the output to another file. the problem is that with...
11
by: Jon Davis | last post by:
Does anyone know why using System.Diagnostics.Process to "wrap" a console application does not always transmit the I/O, depending on what processes you're trying to "consume"? PowerShell, for...
13
by: chuckie_9497 | last post by:
hello all you gurus. I am struggling with releasing com objects. I have isolated the problem to the code below. Objects are released and the process ends until I use "int k = sheet.Count;" Then...
4
by: Steven De Smet | last post by:
Hello, This is my first post. I searched on the internet for answers but I was unable to solve my problem. So I hope that you guy's can help me with my VB.NET problem I tried to create a...
7
by: Samuel A. Falvo II | last post by:
I have a shell script script.sh that launches a Java process in the background using the &-operator, like so: #!/bin/bash java ... arguments here ... & In my Python code, I want to invoke...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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...

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.