Archives

Archives / 2007 / May
  • Steps to enable tracing using appcmd

    Here are the steps you need to enable tracing for a site using appcmd.

    1.       Enable tracing for site.
    2.       Enable tracing for all request paths and for all response codes.
    3.       Appcmd leaves verbosity to default value “warning”. Get the providers count to change verbosity in step 4.
    4.
           Change verbosity to verbose for all providers.

    @REM Step1
    @REM Change site name in the commands if you need to

    %windir%\System32\inetsrv\appcmd configure trace "Default Web Site" /enablesite

    @REM Step2
    @REM Change /statusCodes if you don’t want to enable tracing for all response codes.
    @REM Status code range doesn’t work in vista client. Change accordingly.
    @REM Use /path to enable tracing for requests to particular file. Eg. /path:*.aspx
    @REM Use /timeTaken to enable tracing based on time taken to process request

    %windir%\System32\inetsrv\appcmd configure trace "Default Web Site" /enable /statusCodes:100-999 -commit:apphost

    @REM Step 3
    @REM Change %%V to %V if you are not running in batch mode

    %windir%\System32\inetsrv\appcmd list config "Default Web Site" -section:traceFailedRequests -text:* | findstr provider:> traceproviders.txt
    SET PROCOUNT=-1
    for /F %%V in (traceproviders.txt) do set /a PROCOUNT = PROCOUNT + 1

    @REM Step 4
    @REM Change %%V to %V if you are not running in batch mode

    for /L %%V in (0,1,%PROCOUNT%) do %windir%\System32\inetsrv\appcmd set config "Default Web Site" /section:traceFailedRequests /[path='*'].traceAreas.[@%%V].verbosity:Verbose -commit:apphost

    You can remove step3 and change step 4 to run blindly from 0 to 3. You might get invalid index errors from appcmd if you have less than 4 providers installed on your machine which you can ignore.

    -Kanwal-