I need to check if IISexpress is already running in the system or not.. If not then I need to start IISExpress with Admin permissions.
To achieve this I am using the following code
var processes = Process.GetProcessesByName(
settings.Default.IISExpressProcessName).ToList();
if (processes.Count != 0) return;
var pass = new SecureString();
foreach (char chr in settings.Default.Password)
{
pass.AppendChar(chr);
}
var iisExpress = Environment.ExpandEnvironmentVariables(
settings.Default.IISExpressExecutableFilePath);
Process.Start(new ProcessStartInfo
{
FileName = iisExpress,
UseShellExecute = false,
CreateNoWindow = true,
Verb = "runas",
//UserName =settings.Default.UserName,
//Password = pass,
Arguments = settings.Default.IISExpressArguments
});
The issue here is that it does not start IISExpress in admin mode.
Can any one help me here?
Just change your code little bit to
Process process = Process.Start(new ProcessStartInfo()
{
FileName = IIS_EXPRESS,
Arguments = arguments.ToString(),
RedirectStandardOutput = true,
UseShellExecute = true,
CreateNoWindow = true,
Verb = "runas"
});
this shall do the trick