- 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.
- 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.
- 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.
- Type the command $sm = Get-IISServerManager $sm.ApplicationPools.Add("NanoAppPool") to create the application pool NanoAppPool, as shown here:
- 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()
- Let's check whether this command was successful. Access Nano Server remotely at \172.16.15.63c$WindowsSystem32inetsrvconfig. Inside the config folder, you will get the ApplicationHost.config file. Open ApplicationHost.config and search the MyApp virtual directory, as shown here:
- Here you can see NanoAspNet website with a virtual directory MyApp and virtual directory application pool NanoAppPool.
- 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:
- As you can see, the firewall allows port 8000, and the rule has been created.