I have a service with WCF in a WPF application (self-service), and I have a typical error: "Your process does not have permission to access this namespace." Users do not have administrator rights, so using .manifest is not a solution. The ports are dynamic, the application calculates a free port every time it starts, so the application must insert the netsh listening port several times. I use ProcessStartInfo with a domain administrator, but the user needs administrator privileges to start the process. Launch the application, since the administrator is not a solution, so I need a regular user to be able to run the application, and the program will add the netsh port as the domain administrator.
My process looks something like this:
ProcessStartInfo psi = new ProcessStartInfo("netsh", parameter);
SecureString ss = new SecureString();
for (int i = 0; i < adminPass.Length; i++)
ss.AppendChar(adminPass[i]);
psi.Password = ss;
psi.UserName = Admin;
psi.Domain = Domain;
psi.Verb = "runas";
psi.RedirectStandardOutput = false;
psi.CreateNoWindow = true;
psi.WindowStyle = ProcessWindowStyle.Hidden;
psi.UseShellExecute = false;
Process.Start(psi);
Thank you so much
source
share