【问题标题】:Running perl script from asp.net application deployed on IIS 7.5从部署在 IIS 7.5 上的 asp.net 应用程序运行 perl 脚本
【发布时间】:2011-04-28 06:41:15
【问题描述】:

我有一个非常紧急的要求。我有一个在 MVC 架构中完成的框架 4.0 上的 ASP.net 应用程序。在应用程序中,我调用 Perl 脚本将数据从 MySQL 复制到后端的 SQL Server 2010。当我从 Visual Studio 2010 运行应用程序时,Perl 脚本成功运行并复制了数据。但是当我在 IIS 7.5 上部署相同的应用程序时,它没有显示任何更改或 Perl scipt 没有运行。我尝试打印代码的每一步,发现所有路径都正确。 perl 脚本将通过批处理文件运行。

下面是启动运行批处理文件的过程的代码,该批处理文件又运行 Perl 脚本:

string strPath = string.Empty;
string strDirectory = string.Empty;
try {   
    strPath = "/k " + ConfigurationManager.AppSettings["UploadTLInfo"];//Path of the batch file comes from here 
    strDirectory = ConfigurationManager.AppSettings["WorkingDirectory"];
    ProcessStartInfo psi = new ProcessStartInfo("cmd.exe",strPath);
    psi.UseShellExecute = false;
    psi.WorkingDirectory = strDirectory;
    //psi.CreateNoWindow = true;
    //psi.WindowStyle = ProcessWindowStyle.Hidden;
    Process p = new Process();
    p.StartInfo = psi;
    p.Start();                
} catch (Exception ex) {
    throw ex;
}

【问题讨论】:

标签: asp.net perl iis deployment


【解决方案1】:

很可能,您的问题与用户权限有关 - 当您从 VS 运行时,您可能正在使用 ASP.NET 开发服务器并且它使用当前用户的凭据,而当您从 IIS 运行时,它将使用 NETWORK_SERVICE(或类似的系统用户)可能具有导致问题的有限权限。另一个(但不太可能)的问题可能是批处理文件和/或珍珠可能依赖于一些未在机器级别等定义的环境变量。

其中一个解决方案是运行该进程以模拟另一个具有特定权限和/或环境 (see this to run process as another user) 的用户。

【讨论】:

  • 我尝试使用 impersonation=true 以及我的域用户名和密码。但它不起作用
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-02-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多