Vb.net Web服务未运行exe

Vb.net Web服务未运行exe,vb.net,web-services,visual-studio-2010,exe,Vb.net,Web Services,Visual Studio 2010,Exe,我提到了一些关于如何在stackoverflow上执行此操作的内容 我尝试从以下参考代码进行测试: 版本:框架3.5 VisualStudio2010 当我在浏览器中运行下面的代码时,我看到了要单击的项目符号。当我点击它时,什么也没发生。我的exe只是定位一个xml文件并从中创建一个新文件。我想使用Web服务来运行exe。我的代码中是否缺少某些内容?我看到其他版本有更多的代码,但我试过了,还是没有运气[检查我的链接] 这是我的第一个网络服务,所以我边走边学习 Imports System.W

我提到了一些关于如何在stackoverflow上执行此操作的内容

我尝试从以下参考代码进行测试:

版本:框架3.5

VisualStudio2010

当我在浏览器中运行下面的代码时,我看到了要单击的项目符号。当我点击它时,什么也没发生。我的exe只是定位一个xml文件并从中创建一个新文件。我想使用Web服务来运行exe。我的代码中是否缺少某些内容?我看到其他版本有更多的代码,但我试过了,还是没有运气[检查我的链接]

这是我的第一个网络服务,所以我边走边学习

Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
Imports System.IO

' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebService(Namespace:="http://localhost/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
Public Class Service1
Inherits System.Web.Services.WebService

Dim File As String

<WebMethod()> _
Public Sub runExe()

Dim exe = "C:\WindowsApplication1\bin\Debug\WindowsApplication1.exe"
    'Dim file = "C:\Test\test.xml"

    Dim startInfo As New ProcessStartInfo()
    startInfo.FileName = exe
    'startInfo.Arguments = file
    Process.Start(startInfo)

    'REFERENCE: https://www.dotnetperls.com/process

End Sub
但是exe没有运行,我没有看到在exe发送到的文件夹路径中创建的新文件

还尝试:

Dim processInfo = New ProcessStartInfo(exe)
Dim process__1 = Process.Start(ProcessInfo)
process__1.WaitForExit(5000)
Dim exitCode = process__1.ExitCode
process__1.Close()
Return
什么也没发生

更新:

没有想到使用输出测试来发现我的问题。我使用了以下方法:

While Not process__1.StandardOutput.EndOfStream
   Dim line As String = process__1.StandardOutput.ReadLine()
End While

回应你的评论


我计划使用我的asp.net应用程序与此服务通信以运行exe。所以我想我的客户

这是对web应用程序工作方式的错误理解。您的服务器端ASP.NET代码(VB部分)就是服务器端。所有这些代码都在web服务器上执行。浏览器/客户端/等对此一无所知

(想象一下,在一个世界里,你访问的任何网站都可以在你的计算机上任意执行他们想要的任何.NET代码。这听起来并不有趣。)


如果希望客户端执行应用程序,则必须将应用程序发送给客户端(例如下载应用程序的链接),并基本上要求客户端运行应用程序。服务器端代码无法在客户端计算机上自动执行应用程序。

WindowsApplication1.vshost.exe
?您不是想运行
WindowsApplication1.exe
?另外,您可以进行一些调试以确认应用程序没有被执行吗?可能在应用程序中包含一些调试输出?或者在这里调用时读取流程的输出?看起来很可能是因为你没有捕捉到或者你的测试没有做你认为它做的事情而失败。是的,那是打字错误。我将研究如何创建流程的输出@DavidAlso,虽然这可能是显而易见的,但这通常是值得一问的,因为很多人都被挂断了电话。。。您希望此应用程序在服务器或客户端上运行吗?我计划使用我的asp.net应用程序与此服务通信以运行exe。所以我认为客户@David难道这不意味着如果被应用程序使用,Web服务通常是服务器端的吗?我还使用了以下测试代码
,而不是process\uu 1.StandardOutput.EndOfStream“使用line Dim line作为String=process\uu 1.StandardOutput.ReadLine()结束时
,它确实确定我映射到了错误的位置。我保存了我的新位置,但没有在我的问题所在的新位置重建。@narue1992:Web服务是服务器端的。这个名字甚至暗示了这一点。这是一项通过网络公开的服务。似乎您对web应用程序的工作方式有一些基本的误解。
While Not process__1.StandardOutput.EndOfStream
   Dim line As String = process__1.StandardOutput.ReadLine()
End While