Azure functions Azure函数Process.Start()C#因为不同的用户访问被拒绝错误
我正在尝试使用Process.Start命令在azure函数(v2)中运行可执行文件,方法是提供用户的用户名和密码Azure functions Azure函数Process.Start()C#因为不同的用户访问被拒绝错误,azure-functions,Azure Functions,我正在尝试使用Process.Start命令在azure函数(v2)中运行可执行文件,方法是提供用户的用户名和密码 string nwPath = <path/to/bla.exe> string dirName = Path.GetDirectoryName(nwPath); var processInfo = new ProcessStartInfo() { WorkingDirectory = dirName,
string nwPath = <path/to/bla.exe>
string dirName = Path.GetDirectoryName(nwPath);
var processInfo = new ProcessStartInfo()
{
WorkingDirectory = dirName,
FileName = nwPath,
UserName = <username>,
Password = secureString,
Domain = <domain>,
UseShellExecute = false,
Arguments = @"p1 p3",
Verb = "runas"
};
Process.Start(processInfo);
string nwPath=
字符串dirName=Path.GetDirectoryName(nwPath);
var processInfo=new ProcessStartInfo()
{
WorkingDirectory=dirName,
FileName=nwPath,
用户名=,
密码=安全字符串,
域=,
UseShellExecute=false,
参数=@“p1 p3”,
动词=“符文”
};
Process.Start(processInfo);
此函数使用传入的用户名和密码在本地运行。当我将此部署到azure时,我遇到以下错误
访问被拒绝
我已经通过点击上传按钮上传了azure函数中的可执行文件,可执行文件路径为
C:\home\wwwroot\functionname\bla.exe
如果我使用以下命令运行该进程,它将在azure上运行
process.Start(@“path/to/bla.exe”)
我假设在用户下运行的进程没有访问可执行文件的权限
我们是否可以授予用户访问azure函数中可执行文件的权限 由于azure func的体系结构,您似乎无法指定用户权限 在
ProcessStartInfo
private static string HostingPath =>
Environment.GetEnvironmentVariable("AzureWebJobsScriptRoot") // local_root
?? (Environment.GetEnvironmentVariable("HOME") == null
? Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)
: $"{Environment.GetEnvironmentVariable("HOME")}/site/wwwroot");
由于azure func的体系结构,您似乎无法指定用户权限 在
ProcessStartInfo
private static string HostingPath =>
Environment.GetEnvironmentVariable("AzureWebJobsScriptRoot") // local_root
?? (Environment.GetEnvironmentVariable("HOME") == null
? Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)
: $"{Environment.GetEnvironmentVariable("HOME")}/site/wwwroot");
添加托管路径后没有运气。可执行路径存在,但在指定用户下运行的进程没有读取或写入权限。我想向用户添加读取权限。@SudhakarReddy您的控制台应用程序试图做什么?另外,您是否可以尝试在不传递用户名和密码的情况下运行?因此,如果我无法提供对文件夹的权限,那么是否有任何方法可以在azure中运行可执行文件?我想在特定用户下运行可执行文件。如果您的.exe应用程序试图将某些数据写入/site/wwwroot文件夹,它将收到异常添加托管路径后没有运气。可执行路径存在,但在指定用户下运行的进程没有读取或写入权限。我想向用户添加读取权限。@SudhakarReddy您的控制台应用程序试图做什么?另外,您是否可以尝试在不传递用户名和密码的情况下运行?因此,如果我无法提供对文件夹的权限,那么是否有任何方法可以在azure中运行可执行文件?我想在特定用户下运行可执行文件。如果您的.exe应用程序试图将某些数据写入/site/wwwroot文件夹,它将收到异常