loading...

Microsoft IIS 10.0 – Configuring ASP.NET Core with IIS on Nano Server

How to Install SQL Server 2019 on Windows Server

In this recipe, we will install HttpPlatformHandler on the WIN2016IIS server (this is the physical server) and configure httpPlatformHandler.dll and httpplatform_schema.xml from WIN2016IIS to Nano Server. We will configure our ASP.NET Core application on Nano Server. We will connect Nano Server remotely through PowerShell and manage IIS over 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 installation of ASP.NET Core on Nano Server 2016. For all this installation and configuration work, you should have administrative privileges.

How to do it…

  1. Log in to the WIN2016IIS server (this is not Nano Server, but a normal server). Open Internet Explorer and type in the address bar http://www.iis.net/downloads/microsoft/httpplatformhandler to download HttpPlatformHandler x64, as shown here:
  1. Click on the selected link, and it will start downloading HttpPlatformHandler.
  2. Run HttpPlatformHandler on WIN2016IIS. You will get the installation page of HttpPlatformHandler, as shown here:
  1. Click on Next, follow the default steps, and finish the installation of HttpPlatformHandler.

 

 

  1. On the WIN2016IIS server, go to C:\Windows\System32\inetsrv, find httpPlatformHandler.dll, and copy it to the desktop of the WIN2016IIS server. I have created a folder named ASP Net core\ASP.net, and I will paste httpPlatformHandler.dll in it. Now, go to C:\Windows\System32\inetsrv\config\schema and copy httpplatform_schema.xml to Asp Net core\ASP.net, as shown here:
  1. As shown in the screenshot, we have copied the httpplatform_schema.xml and httpPlatformHandler.dll files.
  2. Copy httpPlatformHandler.dll from ASP Net Core\ASP.net, remotely access the Nano Server location \\172.16.15.63\c$\Windows\System32\inetsrv\, and paste it, as shown here:
  1. Copy httpplatform_schema.xml from ASP Net Core\asp.net, remotely access the Nano Server location \\172.16.15.63\c$\Windows\System32\inetsrv\config\schema, and paste 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 on your keyboard, and you will get the Run window. Open PowerShell ISE with administrative rights, type in the Run command window
    RunAs /user:Administrator PowerShell_ISE.exe, and press OK.
In this command, Administrator is the username for that machine; you can use any username that has administrator rights to perform the given task.
  1. Now it will ask you the administrator password for your Windows Server 2016 (not Nano Server) instance. Type the administrator password and press Enter. You will get the PowerShell window.
  2. Now you have to remotely connect to Nano Server 2016 at 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 password and press OK to log in. You have now connected successfully. Write Import-module iisAdministration and press Enter. This will import the PowerShell module.
  3. Now you need to install the Reverse Forwarders packages, which you created in the Packages folder in the Nano Server C:\ drive, and copy the Nano Server Packages, as shown here:
  1. Type the dism/online/addpackage/packagepath:c:\packages\Microsoft-OneCore-ReverseForwarders-Package.cab and dism /online /add-package /packagepath:c:\packages\en-us\Microsoft-OneCore-ReverseForwarders-Package.cab DISM commands and run them, as shown here:
  1. Let’s move on to configuring ASP.NET Core. We have already copied the required DLL and XML files. Type the following commands in PowerShell:

      $sm = Get-IISServerManager
      $sm.GetApplicationHostConfiguration()
      .RootSectionGroup.Sections.Add("appSettings")
      $appHostconfig = 
      $sm.GetApplicationHostConfiguration()
      $section = 
      $appHostconfig.GetSection
      ("system.webServer/handlers")
      $section.OverrideMode="Allow"
      $sectionHttpPlatform = 
      $appHostConfig.RootSectionGroup.SectionGroups
      ["system.webServer"].Sections.Add("httpPlatform")
      $sectionHttpPlatform.OverrideModeDefault = "Allow"
      $globalModules = Get-IISConfigSection 
      "system.webServer/globalModules" | Get- 
      IISConfigCollection
      New-IISConfigCollectionElement $globalModules - 
      ConfigAttribute 
      @{"name"="httpPlatformHandler";
      "image"="%SystemRoot%\system32\inetsrv\
       httpPlatformHandler.dll"}
       $modules = Get-IISConfigSection 
      "system.webServer/modules" | Get-IISConfigCollection 
      New-IISConfigCollectionElement 
      $modules -ConfigAttribute 
      @{"name"="httpPlatformHandler"}$sm.CommitChanges()
  1. You can see in the screenshot that we’ve configured the required steps to run ASP.NET Core on Nano Server. However, you have to do a few more things in your core application and publish the code with the DNU publish command. You can find out more at https://blogs.iis.net/davidso/nano/aspnet.

How it works…

In this recipe, we installed HttpPlatformHandler on the WIN2016IIS server (physical server, not Nano Server). We then copied httpPlatformHandler.dll and httpplatform_schema.xml from WIN2016IIS and pasted them to Nano Server. We configured httpPlatformHandler.dll and httpplatform_schema.xml on Nano Server through PowerShell. We also configured the ReverseForwarders package on Nano Server.

Comments are closed.

loading...