通过 ASP.NET 页面在服务器上运行程序

发布于 2024-11-24 06:02:00 字数 1351 浏览 3 评论 0原文

我们正在使用一种特殊的软件,该软件通常在我们的一台服务器计算机上运行,​​用于解决一些科学问题并生成复杂的绘图(jpg)。该程序的问题在于它通过命令行运行并且不能提供非常好的用户体验。为了解决这个问题,我开发了一个 ASP.NET 页面,它使用 System.Diagnostics.Process 方法调用服务器程序,并将计算值返回给 LAN 上的用户。

当我在调试模式 (Visual Studio 2010) 下运行 ASP.NET 应用程序时,我能够看到程序窗口并且所有内容都已正确计算。然而,当我将它部署到 IIS 上时,该程序的行为就很奇怪。生成的图未正确显示某些值/颜色代码。另外,当 ASPNET 进程调用该程序时,我无法看到程序窗口。

有任何线索说明为什么会发生这种情况吗?我正在尝试以提升的权限运行 ASP.NET 应用程序,但不知道如何执行此操作。我在互联网上查看了数百篇帖子,但找不到任何具体内容。如果有人能指出我正确的方向,我会很高兴。

系统信息: Windows 7 家庭版 IIS 7 Visual Studio 2010 (VB.NET)

我是初学者,因此请您尽可能提供关键术语的参考资料。

谢谢

这是我从 ASP.NET 应用程序调用程序的方式 -

Hi Kev,这就是我调用应用程序的方式:

        Dim luaProcess As Process = New Diagnostics.Process
        luaProcess.StartInfo.FileName = strFemmExePath
        luaProcess.StartInfo.Arguments = " -lua-script=" + strUserLuaFile

        luaProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
        luaProcess.StartInfo.UseShellExecute = False
        luaProcess.StartInfo.CreateNoWindow = False
        luaProcess.StartInfo.RedirectStandardError = True
        luaProcess.Start()

strFemmExePath 变量被定义为服务器计算机上的 exe 路径,即 C\Program Files\FEMM\bin \femm.exe。参数采用一个包含程序指令的脚本文件。

输出基本上是 2 个文件:

1 个包含计算值的格式化文本文件,我正在使用 ASP.NET 读取该值,并在进行一些格式化后显示出来。

第二个文件是包含图形的位图文件。我使用 ASP.NET 应用程序将此位图转换为 jpeg,因为它的大小非常大。

we are using a special software that usually runs on one of our server machines and is used to solve some scientific problems and generate complex plots (jpg). The problem with this program is that its run through the command line and does not provide for a very good user experience. To address this issue, I have developed an ASP.NET page that calls the server program using System.Diagnostics.Process method and returns the computed values to users on our LAN.

When I run the ASP.NET application in debug mode (Visual Studio 2010), I am able to see the program window and everything is computed properly. However, as soon as I deploy it on IIS, the program is behaving strangely. The plots that are generated do not show some values/color codes correctly. Also, I am unable to see the program window when the ASPNET process calls the program.

Any clues why this could be happening? I am trying to run the ASP.NET application with elevated privileges but have no clue how to do it. I have checked out hundreds of posts on the internet but was unable to find anything specific. Would be glad if someone can point me in the right direction.

System Info:
Windows 7 Home
IIS 7
Visual Studio 2010 (VB.NET)

I am a beginner, so request you to provide any references to key terms if possible.

Thanks

Here is how I am calling the program from the ASP.NET application -

Hi Kev, this is how I am calling the application:

        Dim luaProcess As Process = New Diagnostics.Process
        luaProcess.StartInfo.FileName = strFemmExePath
        luaProcess.StartInfo.Arguments = " -lua-script=" + strUserLuaFile

        luaProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
        luaProcess.StartInfo.UseShellExecute = False
        luaProcess.StartInfo.CreateNoWindow = False
        luaProcess.StartInfo.RedirectStandardError = True
        luaProcess.Start()

The strFemmExePath variables is defined as the exe path on the server machine i.e. C\Program Files\FEMM\bin\femm.exe. The Argument takes a script file that carries the instructions for the program.

The output is basically 2 files:

1 formatted text file that contains the computed values, which I am reading using ASP.NET and displaying back after some formatting.

The second file is a bitmap file which contains a graph. I am converting this bitmap into a jpeg using the ASP.NET application because its very large in size.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

§对你不离不弃 2024-12-01 06:02:00

您看到控制台应用程序在开发 PC 上运行的唯一原因是您在自己的帐户下运行 Visual Studio,并且很可能使用内置的 Cassini 服务器。这意味着控制台应用程序将在您的帐户下启动,并且有权显示控制台窗口。

当在服务帐户(例如 IIS 工作进程使用的帐户)下运行时,这些帐户无法与登录用户的桌面交互,因此永远不会显示任何类型的 UI。

您的应用程序无法正确输出绘图的原因可能多种多样,并且在不知道其工作原理的情况下很难推测。

The only reason you're seeing your console application running on your development PC is because your running Visual Studio under your own account and most likely using the built-in Cassini server. This means the console app will launch under your account and will have permission to display a console window.

When running under a service account (such as those used by and IIS worker process) these accounts can't interact with the desktop of the logged in user and thus will never show a UI of any sort.

The reasons as to why your application isn't outputting the plots correctly could be many and varied and without knowing how it works it would be hard to speculate.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文