Diagnosing PowerShell ASP Scripts

PowerShell ASP offers some basic diagnostics facilities that can help you troubleshoot problems with PowerShell ASP itself or your own scripts. These are:

Request logging

You can enable some basic tracing and logging of request processing. This can be useful in troubleshooting issues where PowerShell ASP itself might appear to be working incorrectly or with unexpected results. To enable request logging and write the log to a file, edit your Web.Config file and add the following lines to it:

    <add name='psasp-log' value='4'/>
  <trace autoflush='true'>
      <remove name='Default'/>
      <add name='TextFile'
           initializeData='c:\temp\psasp.log' />

Validating Page Translation

Sometimes you may run into situations in which a PowerShell ASP page (*.ps1x) is generating unexpected HTML output or with unexpected formatting. In those cases, it can be useful to verify how PowerShell ASP is translating the script into the raw PowerShell code that is executed.

You can configure PowerShell ASP to write the translated page script into a file, by adding the following lines to your Web.Config file:

    <add name='psasp-files' value='4'/>

With this option enabled, PowerShell ASP will write a file right next to your *.ps1x script with the same file name and the extension *.ps1x.tmp. To do this successfully, the application user must have write permissions to the web folder, so it is recommended that you only enable this option in restricted environments for debugging your scripts.

Concurrent Connection Limit Reporting

The concurrent connection limit is governed by the currently installed license. This limit is reported in each response in the HTTP header "X-PowerShellASP-Connection-Limit".

Copyright (c) 2022 /n software inc. - All rights reserved.
PowerShell Server 2020 - Version 20.0 [Build 8165]