流程不会运行 [英] Process won't run

查看:52
本文介绍了流程不会运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个Web应用程序来收集用户信息,然后启动一个

过程来计算结果。该过程是第三方可执行文件。我

无法启动流程。这段代码有问题吗?


公共重载共享函数StartApplication(ByVal fileName As String,

ByVal myPath As String)作为流程

尝试

Dim WtDistrib作为新流程

WtDistrib.StartInfo.Verb ="执行"

WtDistrib.StartInfo.CreateNoWindow =真实

Dim SI As New

ProcessStartInfo(" C:\ Inetpub \wwwroot \Uniformity\Pr ocessStuff \WtDistrib.exe")

WtDistrib.Start(SI)

WtDistrib.WaitForExit()

Console.WriteLine(WtDistrib.ExitCode)

控制台。 WriteLine(WtDistrib.exe已关闭:&

WtDistrib.ExitTime&"。

WtDistrib.Close()


Catch e As Exception

Debug.Write(" Error:" + e.Message)

Console.WriteLine("引发了以下异常:+

e.Message

结束尝试


结束功能

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

推荐答案

不要在一个'应该在ASP.NET中工作的方法'中使用Console.WriteLine

网络应用。

如果需要,可以使用System.Diagnostics.Debug.WriteLine。

Peter


- -

联合创始人,Eggheadcafe.com开发者门户网站:
http ://www.eggheadcafe.com

UnBlog:
http://petesbloggerama.blogspot.com


" Caroline"写道:
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:
我正在构建一个Web应用程序来收集用户信息,然后启动一个
过程来计算结果。该过程是第三方可执行文件。我无法启动流程。这段代码有问题吗?

公共重载共享函数StartApplication(ByVal fileName As String,ByVal myPath As String)作为过程
尝试
Dim WtDistrib As新流程
WtDistrib.StartInfo.Verb ="执行"
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已关闭:&
WtDistrib.ExitTime&。)
WtDistrib.Close()

Catch e As Exception
Debug.Write(" Error:" + e.Message)
Console.WriteLine( 引发了以下异常: +
e.Message)
结束尝试

结束功能
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



Caroline,

为什么这种方法的返回类型是处理?这没有意义。

不应该有一个返回类型(或者如果有的话,或许是b / b
成功的布尔值,我想)。 />

您是否在调试器中完成了代码?当你这样做会发生什么?


彼得

-

联合创始人,Eggheadcafe.com开发者门户网站:
http://www.eggheadcafe.com

UnBlog:
http://petesbloggerama.blogspot.com


" Caroline"写道:
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:
我正在构建一个Web应用程序来收集用户信息,然后启动一个
过程来计算结果。该过程是第三方可执行文件。我无法启动流程。这段代码有问题吗?

公共重载共享函数StartApplication(ByVal fileName As String,ByVal myPath As String)作为过程
尝试
Dim WtDistrib As新流程
WtDistrib.StartInfo.Verb ="执行"
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已关闭:&
WtDistrib.ExitTime&。)
WtDistrib.Close()

Catch e As Exception
Debug.Write(" Error:" + e.Message)
Console.WriteLine( 引发了以下异常: +
e.Message)
结束尝试

结束功能
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



我删除了Process返回类型。


当我单步执行时,会抛出异常


WtDistrib.WaitForExit()


没有线程与此进程相关联。


我发布的示例只是我尝试过的几个中的一个。这是我的第一个asp.net应用程序的



" Peter Bromberg [C#MVP]"写道:
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:
不要在一个'应该在ASP.NET
Web应用程序中工作的方法中使用Console.WriteLine。
你可以如果你愿意,可以使用System.Diagnostics.Debug.WriteLine。
Peter

-
联合创始人,Eggheadcafe.com开发者门户网站:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com

卡罗琳写道:
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:
我正在构建一个Web应用程序来收集用户信息,然后启动一个
过程来计算结果。该过程是第三方可执行文件。我无法启动流程。这段代码有问题吗?

公共重载共享函数StartApplication(ByVal fileName As String,ByVal myPath As String)作为过程
尝试
Dim WtDistrib As新流程
WtDistrib.StartInfo.Verb ="执行"
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已关闭:&
WtDistrib.ExitTime&。)
WtDistrib.Close()

Catch e As Exception
Debug.Write(" Error:" + e.Message)
Console.WriteLine( 引发了以下异常: +
e.Message)
结束尝试

结束功能
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



这篇关于流程不会运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆