loading...

Microsoft IIS 10.0 – Configuring a virtual directory in IIS 10.0

How to create virtual machines with VirtualBox

In this recipe, we will create an application pool and assign it to our virtual directory, MyApp. We will create a firewall rule to allow inbound port 8000 for NanoAspNet.

Getting ready

To step through this recipe, you will need a Windows Server 2016 virtual or physical server for remote PowerShell management and configuring a virtual directory on Nano Server 2016. For all this installation and configuration, you should have administrative privileges.

How to do it…

  1. Log in to Windows Server 2016. The IP is 172.16.15.60 and the name WIN2016IIS. Press Windows + R key. You will get the Run window. Open PowerShell ISE with administrative rights: type RunAs /user:Administrator PowerShell_ISE.exe and press OK.
  2. Now, it will ask you the administrator password for your Windows Server 2016 (not Nano Server) machine. Type the password and press Enter. You will get the PowerShell window.
  3. Now you need to remotely connect to Nano Server 2016 using the IP 172.16.15.63. Write the command Enter-PSSession –ComputerName "172.16.15.63" -Credential ~\Administrator.
    You will get a popup window for the Nano Server administrator account password. Enter the password and press OK. You’ll have connected successfully. Now you have to write Import-module iisAdministration and press Enter. This will import the PowerShell module.

 

 

  1. Type the command $sm = Get-IISServerManager $sm.ApplicationPools.Add("NanoAppPool") to create the application pool NanoAppPool, as shown here:
  1. We have now created the NanoAppPool application pool. Let’s move to assigning NanoAppPool to the MyApp virtual directory. Type the following command:

      $manager = Get-IISServerManager
      $website = $manager.Sites["NanoAspNet"]
      $website.Applications["/MyApp"].ApplicationPoolName 
      = "NanoAppPool"$manager.CommitChanges()
  1. Let’s check whether this command was successful. Access Nano Server remotely at \\172.16.15.63\c$\Windows\System32\inetsrv\config. Inside the config folder, you will get the ApplicationHost.config file. Open ApplicationHost.config and search the MyApp virtual directory, as shown here:
  1. Here you can see NanoAspNet website with a virtual directory MyApp and virtual directory application pool NanoAppPool.
  2. We have to open the firewall port 8000 (by default, Nano Server allows IIS ports 80 and 443). Type the command New-NetFirewallRule -DisplayName "Allow Inbound Port 8000" -Direction Inbound –LocalPort 8000 -Protocol TCP -Action Allow, as shown here:
  1. As you can see, the firewall allows port 8000, and the rule has been created.

How it works…

In this recipe, we created the application pool NanoAppPool and assigned the application pool to MyApp. We checked the MyApp application pool, NanoAppPool, to the ApplicationHost.config file. We also created a firewall rule to allow inbound port 8000 for website NanoAspNet.

Comments are closed.

loading...