Using Powershell to create a web application in a folder that is not an application

前端 未结 3 1219
情深已故
情深已故 2021-02-09 16:30

I want to create a web application in IIS that does not live at the root of the IIS site.

i.e. MySite/beta/WebApplication.

This is my starting point:

3条回答
  •  野的像风
    2021-02-09 17:13

    Since some people use the term folder and Virtual Directory, I thought it would be worth posting how you create a New Web Application inside a Folder / Virtual Directory. Which looks like this in IIS Manager.

    You simply need to use the Path as the site name.

    Import-Module WebAdministration
    $SiteName = "Act.Web.API" # IIS Site Name 
    New-WebVirtualDirectory -Site $SiteName -Name APFW-api -PhysicalPath C:\inetpub\wwwroot
    New-WebApplication -Name Act.Web.API -Site $SiteName\APFW-api -PhysicalPath "C:\Program Files (x86)\ACT\APFW-api" -ApplicationPool $SiteAppPool 
    

    $SiteName\APFW-api equals "Act.Web.API\APFW-api" at run time so the highlighted application is created.

提交回复
热议问题