Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System.Diagnostics.Process.Start not work from an IIS

Tags:

When I run System.Diagnostics.Process.Start from my console application it works but the same code when I run from my web service hosted in IIS doesn't work.

Is it some thing to do with ASP.Net privileges?? if yes how can I configure it from my C# code.

like image 765
BreakHead Avatar asked Jan 13 '11 11:01

BreakHead


People also ask

What is system diagnostics process start?

Starts a process resource by specifying the name of an application and a set of command-line arguments, and associates the resource with a new Process component. public: static System::Diagnostics::Process ^ Start(System::String ^ fileName, System::String ^ arguments); C# Copy. public static System.Diagnostics.

How do I start a service in asp net?

Open the Services management console (services. msc). Change to Manual the start type of any service that depends on the ASP.NET State Service and that is set to Automatic. Restart the computer.


2 Answers

ASP.NET Web page and server control code executes in the context of the ASP.NET worker process on the Web server. If you use the Start method in an ASP.NET Web page or server control, the new process executes on the Web server with restricted permissions. The process does not start in the same context as the client browser, and does not have access to the user desktop. http://msdn.microsoft.com/en-us/library/0w4h05yb.aspx

- Give permission for ASP.NET worker process account

to interact with desktop or allow ASP.NET worker process to run in SYSTEM account.

  • To know how to allow worker process to run in SYSTEM account and to know the default permissions of ASPNET account, check this article INFO: Process and Request Identity in ASP.NET: http://support.microsoft.com/default.aspx?scid=kb;en-us;317012

- Enable IIS Admin Service to interact with desktop

To configure this, follow this steps.

  • a. Open Control Panel and follow these steps: For Windows NT: click Services. For Windows 2000, Windows XP, and .NET Server: click Administrative Tools, and then click Services.

  • b. Double-click IIS Admin Service.

  • c. On the Log On tab, select the Allow Service to Interact with Desktop check box. Remember to run IIS Admin Service as a local system.
  • d. Stop and restart the IIS Admin Service.
like image 155
Tim Schmelter Avatar answered Nov 15 '22 11:11

Tim Schmelter


Changing the AppPool worked for me.

  1. IIS > Application Pools
  2. Select Advance Setting for the website
  3. Change Identity to LocalSystem
  4. Restart IIS

enter image description here

like image 45
Ravi Ram Avatar answered Nov 15 '22 11:11

Ravi Ram