loading...

Microsoft IIS 10.0 – Creating an IIS 10.0 virtual directory on Nano Server

How to run your first application on Kubernetes

In this recipe, we will create a website named NanoAspnet. We will create a virtual directory inside the website called NanoAspnet. We will then remotely connect to Nano Server using PowerShell and manage IIS using the IISAdministrator module and Nano Server.

Getting ready

To step through this recipe, you will need a Windows Server 2016 virtual or physical server for remote PowerShell management and creating the virtual directory on Nano Server 2016. For all this installation and configuration work, 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 of the server is WIN2016IIS. Press Windows + R. 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 it and press Enter. You will get the PowerShell window.
  3. Now we have to remotely connect to Nano Server 2016 at IP 172.16.15.63. Run the command Enter-PSSession –ComputerName "172.16.15.63" -Credential ~\Administrator. Now you will get a popup window for the Nano Server administrator account password. Enter the Nano Server administrator account password and press OK to log in. You have connected successfully. Now write the command Import-module iisAdministration and press Enter. This will import the PowerShell module.
  4. Now let’s create a website called NanoAspnet. Type New-IISSite -Name "NanoAspNet" -PhysicalPath c:\inetpub\wwwroot -BindingInformation "*:8000:" and run it. The website will be created.
  5. Now let’s check whether NanoAspnet has been created or not. Type Get-IISsite, as shown here:
  1. You can see from the screenshot that we have created the website NanoAspNet with port 8000. Now let’s create the virtual directory MyApp on NanoAspNet. First, we have to create a physical directory (folder on Nano Server) that we can use for the virtual directory. We create a directory called MyApp under C:\inetpub\wwwroot, as shown here:
  1. Now open PowerShell, which is already connected with our Nano Server instance, and type the following command to create a virtual directory:

      $manager = Get-IISServerManager $app = 
      $manager.Sites["NanoAspNet"].Applications.Add
      ("/MyApp", 
      "c:\inetpub\wwwroot\MyApp")$manager.CommitChanges()
  1. You have successfully created the MyApp virtual directory for NanoAspNet.

How it works…

In this recipe, we remotely connected PowerShell with Nano Server to manage IIS over the IISAdministrator module. We used a Windows Server 2016 virtual/physical server instance for remote PowerShell management and creating a virtual directory on Nano Server 2016. We also created a website named NanoAspnet and created a virtual directory MyApp inside NanoAspNet.

Comments are closed.

loading...