从启动ASP.NET新工艺 [英] Launching new process from ASP.NET

查看:92
本文介绍了从启动ASP.NET新工艺的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常艰难的时间与一些C#/ ASP.NET(.NET 4)code,在我的开发环境中工作得很好,但就是不工作在生产服务器上。

I'm having a very hard time with some C# / ASP.NET (.Net 4) code that works just fine in my development environment, but just isn't working on the production server.

在code部分试图启动一个新的进程运行lame.exe(转换一个.wav文件.MP3):

Part of the code attempts to launch a new process to run lame.exe (to convert a .WAV file to .MP3):

Process convert = new Process
     {
       StartInfo =
       {
        FileName = AppDomain.CurrentDomain.BaseDirectory + "bin\\lame.exe",
        Arguments =  "--quiet -q 5 -b 16 \"" + filePath + "\" " + directory + "\\" +                                                        tempfile,
        UseShellExecute = false,
        RedirectStandardInput = true,
        RedirectStandardOutput = true
       }
     };

 convert.Start();
 convert.WaitForExit();

这工作正常我的Windows 7开发的PC上。但是,生产的Windows 2008 R2的服务器上,它不会做任何事情:它不会崩溃,或抛出任何异常,只是没有做任何事情。

And this works fine on my Windows 7 development PC. However, on the production Windows 2008R2 server, it doesn't do anything: it doesn't crash, or throw any exceptions, just doesn't do anything.

我知道这几乎可以肯定是由用户权限引起的,但我在努力解决这个问题。看了几十篇文章,一些这是相互矛盾的,我想不出该怎么办。

I realise this is almost certainly caused by user permissions, but I'm struggling to fix the issue. Having read dozens of articles, some of which contradict each other, I can't figure out what to do.

所有程序需要做的就是运行 lame.exe 的Inetpub \\网站\\ BIN 目录和吐出从一个目录中的文件到另一个。我相当确信 lame.exe 甚至没有首发:有重定向到StandardOutput一个StreamReader,我没有看到任何东西被输出。再次,没有异常或错误,显然生成的。

All the application needs to do is run lame.exe from the inetpub\site\bin directory and spit out a file from one directory to another. I'm fairly sure that lame.exe isn't even starting: having redirected StandardOutput to a StreamReader, I don't see anything being output. And again, no exceptions, or errors, are apparently generated.

此应用程序在它自己的应用程序池中运行,根据ApplicationPoolIdentity。在W3发布服务本地系统下运行,我已经试过勾选允许服务与桌面交互。

The application is running in it's own App Pool, under the "ApplicationPoolIdentity". The W3 Publishing Service is running under Local System, and I've tried ticking the "Allow Service to interact with desktop".

我甚至给出了网络服务帐户(临时)完全访问权限到整个 \\的Inetpub \\网站目录。

I've even given (temporary) full access rights for the Network Service account to the whole \inetpub\sitedirectory.

有谁知道IIS7.5下获得ASP.NET创建一个新的进程的'权威'的方式,而我需要使用什么凭据和/或权利?有没有简单的方法来看看我的外部进程正在启动,这样我就可以缩小,其中明显缺乏权限是咬我?

Does anyone know of a ''definitive'' way of getting ASP.NET under IIS7.5 to create a new process, and what credentials and/or rights do I need to use? Is there any easy way to see IF my external process is being started, so I can narrow down where the apparent lack of permissions is biting me?

推荐答案

约翰·桑德斯说什么一个asp.net线程内没有创造过程!我会建议只是有下面的源目录和文件在后台转换服务器上运行的第二个过程,但我看你正试图等待结果。这也是因为,直到它完成将停止处理线程一个坏主意 - 这也不会在生产服务器上属于不使用这种方式,你杀了可伸缩性长时间运行的任务

What John Saunders says about not creating process inside an asp.net thread! I would recommend just having a 2nd process running on the server that follows the source directory and converts the files in the background, but I see you are attempting to wait for the result. This is also a bad idea as it would halt the processing thread until it completes -- this also does not belong on a production server don't use long-running tasks that way, you kill scalability.

这篇关于从启动ASP.NET新工艺的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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