PowerShell ASP: Hosting PowerShell ASP in IIS
Hosting PowerShell ASP in IIS is a very simple and straight-forward process. This article uses IIS 7.5, but the process is very similar for other versions of IIS.
The first step is to open IIS and expand your Server, then site.
Next, right-click the site and select “Add Application”.
This will open the “Add Application” dialog. Here you will need to specify your site’s alias, the Application pool (I used the ASP.NET v4.0 pool because I have PowerShell 3.0 installed on this machine), and the Physical path to where the site exists on disk.
- In order to ensure the PowerShell ASP handlers are properly registered, either copy the web.config file from the PowerShell ASP installation folder to your newly created site’s folder or make sure your new site’s web.config contains the following in the <system.webServer> section:
<handlers> <add name="*.ps1x_*" path="*.ps1x" verb="*" type="nsoftware.PSHandler, nsoftware.PowerShellASP" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode" /> <add name="*.as1x_*" path="*.as1x" verb="*" type="nsoftware.PSRSSHandler, nsoftware.PowerShellASP" preCondition="integratedMode" /> <add name="*.rs1x_*" path="*.rs1x" verb="*" type="nsoftware.PSRSSHandler, nsoftware.PowerShellASP" preCondition="integratedMode" /> </handlers>
- Ensure that you have copied the nsoftware.PowerShellASP.dll file into your site’s “bin” folder.
- If you have installed PowerShell 3.0 on your web server, then you will need to ensure that your site’s Application Pool is configured to use .NET 4.0.
- Ensure that the identity used by your Application Pool has been granted sufficient permissions to access the Physical path (location on disk) of your new site.
- It is recommended to disable PowerShell ASP from within the PowerShell Server GUI. IIS simply uses PowerShellASP.dll so having PowerShell ASP enabled in the GUI isn’t necessary.
We appreciate your feedback. If you have any questions, comments, or suggestions about this article please contact our support team at firstname.lastname@example.org.