简体   繁体   English

如何在asp.net网站上执行EXE文件?

[英]How can I execute an EXE file in asp.net website?

I have a website in asp.net with VB, and I have a link to a medical program that is installed in PC, when I click the link I want to execute the .exe for this program. 我在asp.net中有一个使用VB的网站,当我单击该链接时,我有一个指向PC中安装的医疗程序的链接,我希望对该程序执行.exe。 I found this code but it´s works only when my project is locally: 我找到了以下代码,但仅当我的项目在本地时才有效:

 System.Diagnostics.Process.Start("C:\Windows\System32\MiProgram.exe")

I also tried with this code: 我也尝试使用此代码:

 Dim OpenDoc As ProcessStartInfo = New ProcessStartInfo
 Dim stPath As String = "C:\Windows\System32\MiProgram.exe"
 OpenDoc.FileName = stPath
 OpenDoc.Verb = "open"
 OpenDoc.WindowStyle = ProcessWindowStyle.Normal
 Process.Start(OpenDoc)

Both codes works locally, but when I get my project to the web, does nothing 两种代码都可以在本地运行,但是当我将项目放到网上时,什么也没做

I also read that I can enable de IIS Service, I follow the steps of this page , but is not use to me. 我还阅读到我可以启用de IIS Service,我按照此页面的步骤进行操作,但对我而言并不有用。
Is there any solution to this problem? 有什么解决办法吗?

I accept suggestions. 我接受建议。 Thanks. 谢谢。

Unfortunately, it is not possible to run a program on the client from server-side. 不幸的是,不可能从服务器端在客户端上运行程序。 There is already some discussions about that, here is some links : 已经有关于此的讨论,这里有一些链接:

How to execute an application on the client from a website? 如何通过网站在客户端上执行应用程序?

Run an exe in client machine from a website 从网站在客户端计算机中运行exe

Executing exe on client side using C# 使用C#在客户端执行exe

You can do this with a work around.. 您可以解决此问题。

You create a running Windows Forms application, on that application you host a wcf services, check this link as sample. 您创建一个正在运行的Windows Forms应用程序,在该应用程序上承载wcf服务,并检查此链接作为示例。

Expose a method like `RunApplication' put the same code their, where you can call it from your website, this will 100% work. 公开一个类似“ RunApplication”的方法,将相同的代码放入它们,您可以从您的网站上调用它,这将100%起作用。

You can try by implementing this settings: 您可以尝试通过实施以下设置:

In IIS 7/8 go Control Panel / Program And Features / Turn Windows features on or off, and check all items from: Web Managment Tools, (it's include: IIS Managment Service, II 6 Managment Compatibility) 在IIS 7/8中,转到“控制面板” /“程序和功能” /“打开或关闭Windows功能”,然后从以下位置检查所有项:Web管理工具(包括:IIS管理服务,II 6管理兼容性)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM