[英]'Access is Denied' IIS on killing a windows process
I have created a Web API for installing the latest version of exe using Web API and hosted via IIS Server.
该过程是下载 -> 关闭 -> 通过 CLI 安装 Exe。
下载过程运行良好。
关闭正在运行的 exe 异常时捕获“访问被拒绝”。
以下是我用来关闭正在运行的 exe 的代码块。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using WebGrease;
namespace API.Controllers
{
public class TestController : ApiController
{
public string Get()
{
foreach (Process p in Process.GetProcessesByName("APPLICATION NAME"))
{
try
{
p.Kill();
p.WaitForExit();
}
catch (Exception ex)
{
return ex.Message.ToString();
}
}
return "Aborted";
}
}
}
在调试相同的代码块时工作正常,但在另一台计算机上测试时显示“访问被拒绝”。我猜这个问题与 Windows 身份验证有关。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.