How to a run the ASP worker process under another user credential

Well i discovered this when i had to debug a service on a server on which i no permissions.Since it was a WCF call and was hosted on the IIS,i figured i needed a cheat.So this is what i did.Before i start with the details let me tell you the environments that i have been using.VS-Studio –2008 dotnet stack on Windows XP(sp3).And i was using IIS 5.1 on my machine which is an XP.So here goes.

First change the username and password in the machine.config under the processModel tag as shown below.

Code Snippet
  1. <system.web>
  2.     <processModel autoConfig="true" userName="username" password="******"/>
  3.     <httpHandlers/>

And i tried adding permission to the C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files folder too.

That resulted in an error which gave an “Failed to access IIS metabase” error .So finally i figured MetaAcl tool needs to be downloaded from the following location

http://download.microsoft.com/download/5/7/3/57316f36-ded6-41f0-b694-8b0102ade818/metaacl.exe

This has a metaacl.vbs script which adds permission to the users.You need to add the file to the following folder c:\Inetpub\Adminscripts and then go this folder from the command prompt.Then run the command

c:\Inetpub\Adminscripts>cscript metaacl.vbs IIS://LOCALHOST/W3SVC
                                     mydomain\mydomainaccount RW

 

For more info go to the following KB article in MSDN.(http://support.microsoft.com/kb/326902)

Advertisements