473,811 Members | 1,788 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 StartApplicatio n(ByVal fileName As String,
ByVal myPath As String) As Process
Try
Dim WtDistrib As New Process
WtDistrib.Start Info.Verb = "Execute"
WtDistrib.Start Info.CreateNoWi ndow = True
Dim SI As New
ProcessStartInf o("C:\Inetpub\w wwroot\Uniformi ty\ProcessStuff \WtDistrib.exe" )
WtDistrib.Start (SI)
WtDistrib.WaitF orExit()
Console.WriteLi ne(WtDistrib.Ex itCode)
Console.WriteLi ne("WtDistrib.e xe was closed at: " &
WtDistrib.ExitT ime & ".")
WtDistrib.Close ()

Catch e As Exception
Debug.Write("Er ror: " + e.Message)
Console.WriteLi ne("The following exception was raised: " +
e.Message)
End Try

End Function
Mar 22 '06 #1
16 2158
Don't use Console.WriteLi ne in a method that's supposed to work in an ASP.NET
web app.
You could use System.Diagnost ics.Debug.Write Line 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 StartApplicatio n(ByVal fileName As String,
ByVal myPath As String) As Process
Try
Dim WtDistrib As New Process
WtDistrib.Start Info.Verb = "Execute"
WtDistrib.Start Info.CreateNoWi ndow = True
Dim SI As New
ProcessStartInf o("C:\Inetpub\w wwroot\Uniformi ty\ProcessStuff \WtDistrib.exe" )
WtDistrib.Start (SI)
WtDistrib.WaitF orExit()
Console.WriteLi ne(WtDistrib.Ex itCode)
Console.WriteLi ne("WtDistrib.e xe was closed at: " &
WtDistrib.ExitT ime & ".")
WtDistrib.Close ()

Catch e As Exception
Debug.Write("Er ror: " + e.Message)
Console.WriteLi ne("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 StartApplicatio n(ByVal fileName As String,
ByVal myPath As String) As Process
Try
Dim WtDistrib As New Process
WtDistrib.Start Info.Verb = "Execute"
WtDistrib.Start Info.CreateNoWi ndow = True
Dim SI As New
ProcessStartInf o("C:\Inetpub\w wwroot\Uniformi ty\ProcessStuff \WtDistrib.exe" )
WtDistrib.Start (SI)
WtDistrib.WaitF orExit()
Console.WriteLi ne(WtDistrib.Ex itCode)
Console.WriteLi ne("WtDistrib.e xe was closed at: " &
WtDistrib.ExitT ime & ".")
WtDistrib.Close ()

Catch e As Exception
Debug.Write("Er ror: " + e.Message)
Console.WriteLi ne("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.WaitF orExit()

"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.WriteLi ne in a method that's supposed to work in an ASP.NET
web app.
You could use System.Diagnost ics.Debug.Write Line 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 StartApplicatio n(ByVal fileName As String,
ByVal myPath As String) As Process
Try
Dim WtDistrib As New Process
WtDistrib.Start Info.Verb = "Execute"
WtDistrib.Start Info.CreateNoWi ndow = True
Dim SI As New
ProcessStartInf o("C:\Inetpub\w wwroot\Uniformi ty\ProcessStuff \WtDistrib.exe" )
WtDistrib.Start (SI)
WtDistrib.WaitF orExit()
Console.WriteLi ne(WtDistrib.Ex itCode)
Console.WriteLi ne("WtDistrib.e xe was closed at: " &
WtDistrib.ExitT ime & ".")
WtDistrib.Close ()

Catch e As Exception
Debug.Write("Er ror: " + e.Message)
Console.WriteLi ne("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.WaitF orExit()

"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.WriteLi ne in a method that's supposed to work in an ASP.NET
web app.
You could use System.Diagnost ics.Debug.Write Line 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 StartApplicatio n(ByVal fileName As String,
ByVal myPath As String) As Process
Try
Dim WtDistrib As New Process
WtDistrib.Start Info.Verb = "Execute"
WtDistrib.Start Info.CreateNoWi ndow = True
Dim SI As New
ProcessStartInf o("C:\Inetpub\w wwroot\Uniformi ty\ProcessStuff \WtDistrib.exe" )
WtDistrib.Start (SI)
WtDistrib.WaitF orExit()
Console.WriteLi ne(WtDistrib.Ex itCode)
Console.WriteLi ne("WtDistrib.e xe was closed at: " &
WtDistrib.ExitT ime & ".")
WtDistrib.Close ()

Catch e As Exception
Debug.Write("Er ror: " + e.Message)
Console.WriteLi ne("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\wwwr oot\Uniformity\ ProcessStuff\Wt Distrib.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="tr ue" userName="stron gaccountname" password = "pass" />
to the web.config.

Where "strongaccountn ame" 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.WaitF orExit()

"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.WriteLi ne in a method that's supposed to work in an ASP.NET
web app.
You could use System.Diagnost ics.Debug.Write Line 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 StartApplicatio n(ByVal fileName As String,
> ByVal myPath As String) As Process
> Try
> Dim WtDistrib As New Process
> WtDistrib.Start Info.Verb = "Execute"
> WtDistrib.Start Info.CreateNoWi ndow = True
> Dim SI As New
> ProcessStartInf o("C:\Inetpub\w wwroot\Uniformi ty\ProcessStuff \WtDistrib.exe" )
> WtDistrib.Start (SI)
> WtDistrib.WaitF orExit()
> Console.WriteLi ne(WtDistrib.Ex itCode)
> Console.WriteLi ne("WtDistrib.e xe was closed at: " &
> WtDistrib.ExitT ime & ".")
> WtDistrib.Close ()
>
> Catch e As Exception
> Debug.Write("Er ror: " + e.Message)
> Console.WriteLi ne("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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
8624
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 over and over again i would like to thread this process. could someone point me to some documentation or perhaps an example of
21
13095
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 finished running, I want to do more stuff *condition* on the fact that the shell script has finished running, inside the same python script. The only way I can think of is to fork a process and then call the
5
7962
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 them just hang. I would like to terminate the process after 15 seconds if it doesn't finish, but os.system() doesn't have any timeout parameter. Can anyone help me on what can I use to do this?
0
13749
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 until it's finished. If the command didn't terminate within the timeout, the command is killed. (Ex. 2) - launch the command and continue your processing after the command has been started remotely (Ex. 3).
2
5124
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 request to the cmd window to close? Here's the code snippet that I'm using to make the call: string strArg = "/c ftp.exe -v -n -s:" + strFile + " " + strHost + " > " + strLogFile;
6
1663
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 large files(>8Mb) i get a script error(Fatal error: Maximum execution time of 30 seconds exceeded ). i acess every character in the buffer with $chr=ord($bufferIn{$i}); (where $i=0...8192) seems like all he time the script consumes is in the for...
11
11964
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 example, does not seem to process any I/O through the Process object. I know that in the case of PowerShell there are better ways to "wrap" the console by directly interfacing with the assemblies of System.Management.Automation or some similarly...
13
3016
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 the process does not end. So I feel confident the problem occurrs here. It appears another reference is created that needs to be closed. Can anyone tell me how to do this? :) Thank you Excel.Workbook workbook =
4
8853
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 windows service that converts MS Word Files into .PDF files and after that we want to zip the .PDF files. Our code: Protected Overrides Sub OnStart(ByVal args() As String) ' Add code here to start your service. This method should set...
7
6241
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 this shell script using the Subprocess module. Here is my code: def resultFromRunning_(command):
0
10648
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10402
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
10135
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9205
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 project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7670
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6890
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5554
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3867
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.