Add-WebConfigurationProperty for Failed Request Tracing Issue [Answered]RSS

3 replies

Last post Dec 12, 2019 05:17 PM by carehart

  • Add-WebConfigurationProperty for Failed Request Tracing Issue

    Dec 10, 2019 04:17 PM|jaxjcn01|LINK

    I am writing a Failed Request Tracing script and I have everything working except for this one small hitch.  No matter what I have tried, I cannot, via the script, make the value of ‘path’ anything other than *.  No matter how I have changed the first line it invariably shows as * for the path. Here is the code:

    #Add tracing rule
    Add-WebConfigurationProperty -pspath $pspath -filter "system.webServer/tracing/traceFailedRequests/add[@path=*]" -name "." -value @{path = "*.aspx"}
    Add-WebConfigurationProperty -pspath $pspath -filter "system.webServer/tracing/traceFailedRequests/add[@path=*]/traceAreas" -name "." -value @{provider = “ASPNET”; areas = 'Infrastructure,Module,Page,AppServices'; verbosity = 'Verbose'}
    Set-WebConfigurationProperty -pspath $pspath -filter "system.webServer/tracing/traceFailedRequests/add[@path=*]/failureDefinitions" -name "statusCodes" -value 500

  • Re: Add-WebConfigurationProperty for Failed Request Tracing Issue

    Dec 10, 2019 10:50 PM|lextm|LINK

    Lex Li
    Affordable IIS Consulting Services at https://support.lextudio.com/services/consulting.html
    ---------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Add-WebConfigurationProperty for Failed Request Tracing Issue

    Dec 11, 2019 06:13 AM|Yuk Ding|LINK

    Hi jaxjcn01,

    If you want to set it in your server node, please try this.

    Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST'  -filter "system.webServer/tracing/traceFailedRequests" -name "." -value @{path='*.aspx'}
    
    Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST'  -filter "system.webServer/tracing/traceFailedRequests/add[@path='*.aspx']/traceAreas" -name "." -value @{provider='ASPNET';areas='Infrastructure,Module,Page,AppServices';verbosity='Verbose'}
    Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST'  -filter "system.webServer/tracing/traceFailedRequests/add[@path='*.aspx']/failureDefinitions" -name "statusCodes" -value "500"
    
    

    If you just want to set it in your site level, you could use this.

    Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST/Mysite'  -filter "system.webServer/tracing/traceFailedRequests" -name "." -value @{path='*.aspx'}
    
    Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST/Mysite'  -filter "system.webServer/tracing/traceFailedRequests/add[@path='*.aspx']/traceAreas" -name "." -value @{provider='ASPNET';areas='Infrastructure,Module,Page,AppServices';verbosity='Verbose'}
    Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST/Mysite'  -filter "system.webServer/tracing/traceFailedRequests/add[@path='*.aspx']/failureDefinitions" -name "statusCodes" -value "500"

    Both of them works fine on my side,

    If the reply is helpful, it is appreciated if you could mark it as answer.

    Best Regards,

    Jokies Ding

    Yuk Ding

    MSDN Community Support
    Please remember to "Mark as Answer" the responses that resolved your issue.
  • Re: Add-WebConfigurationProperty for Failed Request Tracing Issue

    Dec 12, 2019 05:17 PM|carehart|LINK

    As for why yours fails to work as expected, @jaxjcn01, it seems you are mistaken in having the /add in the filter, on the line referring to *.aspx. You can see that in the other examples, below and on the web. You need it on the other two lines, not that first one.

    /charlie