gpt4 book ai didi

c# - 应用程序未从生产 Web 服务器运行

转载 作者:太空宇宙 更新时间:2023-11-03 14:18:34 24 4
gpt4 key购买 nike

我必须从我们的内部网站运行一个工具。用户将从 UI 提供的输入很少,然后我想使用用户凭据运行该工具。当我从我的本地机器上运行我的代码时,我的代码工作正常,但是当我将它部署到生产服务器并尝试从那里执行它时,它没有启动任何东西。

这是我的代码,任何建议将不胜感激。

            System.Diagnostics.ProcessStartInfo PSI = new System.Diagnostics.ProcessStartInfo(@"D:\run.bat");             
PSI.UserName = "username";
PSI.Domain = "domain";
System.Security.SecureString securePwd = new System.Security.SecureString();
string password = "password";
foreach (char c in password)
{
// Append the character to the password.
securePwd.AppendChar(c);
}
PSI.Password = securePwd;
PSI.UseShellExecute = false;
process.StartInfo = PSI;
PSI.Arguments = SiteId.Text + " " + WebServiceUrl.Text + " " +LogFile.Text;
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.Start();

最佳答案

首先:

  • 检查您的应用程序池的身份(高级设置)。
  • 将身份切换为“系统”并查看批处理文件是否从网络应用程序运行。

如果是:

  • 将身份改回网络服务,
  • 确保您的批处理文件具有适用于用户网络服务(或您选择的任何身份)的执行权限

如果没有:

  • 尝试用您的代码打开文件并在末尾附加一些无害的文本。
  • 如果可行,您至少可以排除权限和网络应用程序查看能力问题。

关于c# - 应用程序未从生产 Web 服务器运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6005022/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com