简体   繁体   English

从Azure辅助角色运行控制台 - 没有权限

[英]Running a Console from an Azure Worker Role - Do not have permissions

Hello I am trying to run a console app from a Worker Role (as per user demand) but the console fails to execute completely. 您好我正在尝试从工作者角色运行控制台应用程序(根据用户需求)但控制台无法完全执行。

I am doing : 我在做 :

Process proc = new Process();
                proc.StartInfo.FileName = "ZProcessing";
                proc.StartInfo.Arguments = "argument" //example
                proc.StartInfo.UseShellExecute = false;
                proc.StartInfo.UserName = "man1";
                string pass = "lolol213";
                SecureString str = new SecureString();
                char[] chArray = pass.ToCharArray();
                foreach (char c in chArray)
                {
                    str.AppendChar(c);
                }
                proc.StartInfo.RedirectStandardOutput = true;
                proc.StartInfo.RedirectStandardError = true;
                proc.StartInfo.CreateNoWindow = false;
                proc.Start();
                proc.WaitForExit();

I have also tried StartInfo.UseShellExecute = true with proc.StartInfo.Verb = "runas"; 我还尝试了使用proc.StartInfo.Verb = "runas"; StartInfo.UseShellExecute = true proc.StartInfo.Verb = "runas"; but same error..I know the console does not even start because just at the begining it is supposed to create a log file.. 但同样的错误..我知道控制台甚至没有启动,因为只是在开始它应该创建一个日志文件..

Now, I did hardcoded the console, copy pasted it into the server, executed it there and it does create all the files folders and carries on with the analisis it has to do.. 现在,我做了硬编码控制台,复制粘贴到服务器,在那里执行它,它确实创建了所有的文件夹,并继续进行它必须做的分析..

So it is either I am executing it wrongly..or I dont execute it with the enough permissions or something..Or also the combination of Worker Role + Console app is not working.. Help¿? 所以它要么是我错误地执行它。或者我没有用足够的权限或其他东西执行它..或者也没有工作者角色+控制台应用程序的组合工作..帮助?

Check out this SO question . 看看这个问题 I've provided very detailed explanation on how to run external process and what to be careful about. 我已经提供了关于如何运行外部流程以及需要注意的事项的非常详细的解释。 There are also some additional comments by the original question author. 原始问题作者还有一些其他评论。

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

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