简体   繁体   English

从共享主机上的 asp.net 页面启动控制台应用程序

[英]launch console application from asp.net page on shared hosting

i need to launch simple console application from my asp.net webpage, that creates a file using given parameters.我需要从我的 asp.net 网页启动简单的控制台应用程序,它使用给定的参数创建一个文件。 hereis my code:这是我的代码:

string filePath = Server.MapPath(@"~/Patcher/TestPatcher.exe");

System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo(filePath , "-sn:123456789123456 -upd -fn:test.hd");
info.UseShellExecute = false; 
info.RedirectStandardOutput = true;
System.Diagnostics.Process p = System.Diagnostics.Process.Start(info);

p.WaitForExit(25000);
// Display the output
string str = p.StandardOutput.ReadToEnd();

problem is that program doesnt create any file, but it does launch - i got some output in "str".问题是该程序没有创建任何文件,但它确实启动了 - 我在“str”中有一些 output。 any suggestions?有什么建议么? and btw, that website must work on shared hosting.顺便说一句,该网站必须在共享主机上运行。

Yeah.是的。 I think you have a security issue there... you can't just run an exe from a sandboxed environment (which the browser is).我认为你有一个安全问题......你不能只从沙盒环境(浏览器是)运行 exe。

Besides the code snippet you provided, is trying to run code on the webserver, not on from the asp.net page.除了您提供的代码片段外,还尝试在网络服务器上运行代码,而不是从 asp.net 页面上运行代码。

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

相关问题 在共享Linux主机上托管ASP.NET Core应用程序 - Hosting ASP.NET Core application on shared Linux hosting 通过共享Windows托管服务器上托管的ASP.NET Web API应用程序,Google API调用失败 - Google API call fails from an ASP.NET Web API application hosted on shared Windows hosting server 共享托管环境中的ASP.Net MVC - ASP.Net MVC in shared hosting environment 从ASP.NET运行控制台应用程序 - Running Console application from ASP.NET 托管在Kestrel,helios,WebListener和单独的Console进程中托管Asp.Net vNext应用程序的方式有何不同? - How hosting Asp.Net vNext application hosting on Kestrel, helios, WebListener and in separate Console process differs? 如何在 hostgator linux 共享主机上安装 ASP.NET Core 应用程序? - How can I install ASP.NET Core application on a hostgator linux shared hosting? 在共享主机中部署N层ASP.NET Webforms应用程序 - Deploying an N-Layered ASP.NET Webforms Application In A Shared Hosting 从linqpad或控制台应用程序运行asp.net mvc应用程序 - Run asp.net mvc application from linqpad or console application 如何从控制台应用程序在 ASP.NET MVC 应用程序中进行身份验证 - How to authenticate in an ASP.NET MVC application from a console application C#控制台应用程序和ASP.NET WebForms应用程序之间的共享存储 - Shared storage between C# console application and ASP.NET WebForms application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM