简体   繁体   English

System.Diagnostics.Process.Start不适用于IIS,但在ASP.NET开发服务器上

[英]System.Diagnostics.Process.Start not work with IIS, but on ASP.NET Development Server

I am using VS2008 C# and testing on my local XP Pro PC with local IIS, I have wrote a web service to call a third party software .exe file to use svn checkout commands to insert data into a folder, which use System.Diagnostics.Process.Start . 我正在使用VS2008 C#并在具有本地IIS的本地XP Pro PC上进行测试,我编写了一个Web服务来调用第三方软件.exe文件,以使用svn checkout命令将数据插入到使用System.Diagnostics的文件夹中。 Process.Start。 The same codes did work when I use VS2008 build-in ASP.NET Development Server( http://localhost:2999/MyServices/MyServices.asmx ). 当我使用VS2008内置ASP.NET开发服务器( http:// localhost:2999 / MyServices / MyServices.asmx )时,相同的代码确实起作用。 but when I use IIS normal URL( http://developer/MyServices/MyServices.asmx ) to run Process.Start on the web service, it just haunlted and not doing anything.plz send one sample program. 但是,当我使用IIS普通URL( http://developer/MyServices/MyServices.asmx )在Web服务上运行Process.Start时,它只是停顿了而未做任何事情。plz发送了一个示例程序。

This is most likely down to the user being used to run the code. 这很可能取决于用于运行代码的用户。 When using the built-in server, it is running as the same user as Visual Studio is running as. 使用内置服务器时,它以与Visual Studio运行时相同的用户身份运行。 When in IIS, it will be running as the MACHINENAME\\ASPNET user. 在IIS中时,它将以MACHINENAME \\ ASPNET用户身份运行。

If the process you are starting cannot execute as the MACHINENAME\\ASPNET user, it will not work when hosted in IIS unless you change your configuration to change the user it runs as. 如果您要启动的进程无法以MACHINENAME \\ ASPNET用户身份执行,则除非将配置更改为运行时所用的用户,否则将其托管在IIS中时将不起作用。 See this page for more info on what users are used for what in IIS. 有关在IIS中使用哪些用户的更多信息,请参见此页面。

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

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