Home > Computer Programming, Computer Science, Microsoft Related, Problem Solving/Puzzles, Technology > Launching Executables (showing GUI) from Web Services deployed in IIS

Launching Executables (showing GUI) from Web Services deployed in IIS

Recently one of my senior colleague was faced with a problem of launching executables from Web Services hosted in IIS. Following is the problem he was faced with (as is email),

“I am working on a dotNet web service that needs to launch an executable (.exe). I have used System.Diagnostics.Process to launch the process. When I run through VS2005 test environment, web service triggers the executable and its UI is displayed (e.g., launching notepad). But when I deploy the web service under IIS, the web service does launch the process but UI does not appear.

Can someone shed some light on what is happening and suggest a solution to this”

After searching on the internet I found the following solution and it worked fine.

According to Microsoft following are the reasons for this

1.    By default, ASP.NET runs its worker process (Aspnet_wp.exe) with a weak account (the local machine account, which is named ASPNET) which don’t have permission to interact with desktop.
2.    By default, IIS Admin Service won’t allow its application to interact with desktop.

These can be resolved by:

1.    Allowing worker process(ASP.NET) to run in SYSTEM account.
This can be done by editing the machine.config file which is located at (C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG. Open the machine.config and find the ProcessModel tag and add the following attributes to it,

userName=”SYSTEM” password=”AutoGenerate”

2.    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.

d)    Stop and restart the IIS Admin Service.

3.    Sometimes ASP.NET account does not have enough privileges to access certain WMI namespaces. So to resolve this do the following

a)    Open the Computer Management Microsoft Management Console (MMC) snap-in.
b)    Expand Services and Applications, and then select WMI Control.
c)    Right-click WMI Control, and then click Properties.
d)    In the WMI Control Properties dialog box, click the Security tab.
e)    Expand Root, select CIMV2, and then click Security.
f)    In the Security dialog box, click Advanced.
g)    In the Access Control Settings dialog box, click Add. Select localMachineName\ASPNET, and then click OK.
h)    In the Permission Entry dialog box, make sure that Apply Onto is set to This namespace and subnamespaces.
i)    Make sure that the Allow ‘Enable Account’ and Allow ‘Remote Enable’ check boxes are selected.
j)    Click OK in each dialog box until you return to the WMI Control Properties dialog box.
k)    Repeat steps 5 through 10 for other WMI namespaces that your application will access.
l)    Restart IIS. To do this, run IISRESET from the command line.

Information obtained from:

http://support.microsoft.com/default.aspx?scid=kb;en-us;317012
http://support.microsoft.com/kb/555134

Regards,

Advertisements
  1. AftetteSted
    March 13, 2009 at 8:05 pm

    Need more info about Multi stress syllable word? You are welcome! on http://metacures.biz

  2. dude
    December 1, 2010 at 10:41 pm

    Hi,

    do you kwon how a solution to work with windows 7?

  3. SenthilKumar
    July 30, 2012 at 10:56 am

    i want the same thing for windows server 2008?Please reply ASAP if anybody knows

  4. noone
    January 2, 2013 at 6:50 pm

    Same here

  5. June 9, 2013 at 1:11 am

    Heya i’m for the first time here. I came across this board and I find It really helpful & it helped me out much. I am hoping to present something again and aid others such as you helped me.

  6. August 20, 2014 at 2:29 pm

    I am truly glad to read this website posts which includes tons of helpful information,
    thanks for providing such statistics.

  7. Raman Parmar
    February 24, 2015 at 8:02 am

    Not working for me…any other solution…

  8. Priya
    November 21, 2015 at 3:40 am

    Hi,
    If we change machine config’s Process model tag to include Username and password as you suggest above, would it affect all the applications hosted? I have other applications too on same IIS.
    Not sure what will be the impact on other applications.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: