Net core windows server hosting bundle

The .NET Core Hosting Bundle

The .NET Core Hosting bundle is an installer for the .NET Core Runtime and the ASP.NET Core Module. The bundle allows ASP.NET Core apps to run with IIS.

Install the .NET Core Hosting Bundle

If the Hosting Bundle is installed before IIS, the bundle installation must be repaired. Run the Hosting Bundle installer again after installing IIS.

If the Hosting Bundle is installed after installing the 64-bit (x64) version of .NET Core, SDKs might appear to be missing (No .NET Core SDKs were detected). To resolve the problem, see Troubleshoot and debug ASP.NET Core projects.

Breaking changes and security advisories are reported on the Announcements repo. Announcements can be limited to a specific version by selecting a Label filter.

Direct download (current version)

Download the installer using the following link:

Visual C++ Redistributable Requirement

On older versions of Windows, for example Windows Server 2012 R2, install the Visual Studio C++ 2015, 2017, 2019 Redistributable. Otherwise, a confusing error message in the Windows Event Log reports that The data is the error.

Earlier versions of the installer

To obtain an earlier version of the installer:

  1. Navigate to the Download .NET Core page.
  2. Select the desired .NET Core version.
  3. In the Run apps — Runtime column, find the row of the .NET Core runtime version desired.
  4. Download the installer using the Hosting Bundle link.

Some installers contain release versions that have reached their end of life (EOL) and are no longer supported by Microsoft. For more information, see the support policy.

Options

The following parameters are available when running the installer from an administrator command shell:

  • OPT_NO_ANCM=1 : Skip installing the ASP.NET Core Module.
  • OPT_NO_RUNTIME=1 : Skip installing the .NET Core runtime. Used when the server only hosts self-contained deployments (SCD).
  • OPT_NO_SHAREDFX=1 : Skip installing the ASP.NET Shared Framework (ASP.NET runtime). Used when the server only hosts self-contained deployments (SCD).
  • OPT_NO_X86=1 : Skip installing x86 runtimes. Use this parameter when you know that you won’t be hosting 32-bit apps. If there’s any chance that you will host both 32-bit and 64-bit apps in the future, don’t use this parameter and install both runtimes.
  • OPT_NO_SHARED_CONFIG_CHECK=1 : Disable the check for using an IIS Shared Configuration when the shared configuration ( applicationHost.config ) is on the same machine as the IIS installation. Only available for ASP.NET Core 2.2 or later Hosting Bundler installers. For more information, see ASP.NET Core Module.

For information on IIS Shared Configuration, see ASP.NET Core Module with IIS Shared Configuration.

Restart IIS

After the Hosting Bundle is installed, a manual IIS restart may be required. For example, the dotnet CLI tooling (command) might not exist on the PATH for running IIS worker processes.

To manually stop and start IIS, execute the following commands in an elevated command shell:

Module version and Hosting Bundle installer logs

To determine the version of the installed ASP.NET Core Module:

  1. On the hosting system, navigate to %PROGRAMFILES%\IIS\Asp.Net Core Module\V2 .
  2. Locate the aspnetcorev2.dll file.
  3. Right-click the file and select Properties from the contextual menu.
  4. Select the Details tab. The File version and Product version represent the installed version of the module.

The Hosting Bundle installer logs for the module are found at C:\Users\%UserName%\AppData\Local\Temp . The file is named dd_DotNetCoreWinSvrHosting___000_AspNetCoreModule_x64.log , where the placeholder is the timestamp of the file.

Читайте также:  Что значит служба аудио не запущена windows

Пакет размещения .NET Core The .NET Core Hosting Bundle

Пакет размещения .NET Core — это установщик среды выполнения .NET Core и модуля ASP.NET Core. The .NET Core Hosting bundle is an installer for the .NET Core Runtime and the ASP.NET Core Module. Пакет позволяет запускать приложения ASP.NET Core в службах IIS. The bundle allows ASP.NET Core apps to run with IIS.

Установка пакета размещения .NET Core Install the .NET Core Hosting Bundle

Если пакет размещения устанавливается до установки служб IIS, его нужно восстановить. If the Hosting Bundle is installed before IIS, the bundle installation must be repaired. После установки служб IIS запустите установщик пакета размещения еще раз. Run the Hosting Bundle installer again after installing IIS.

Если пакет размещения устанавливается после установки 64-разрядной (x 64) версии .NET Core, пакеты SDK могут не отображаться (см. раздел Пакеты SDK .NET Core не обнаружены). If the Hosting Bundle is installed after installing the 64-bit (x64) version of .NET Core, SDKs might appear to be missing (No .NET Core SDKs were detected). Сведения об устранении проблемы см. в статье Устранение неполадок и отладка проектов ASP.NET Core. To resolve the problem, see Устранение неполадок и отладка проектов ASP.NET Core.

Критические изменения и рекомендации по безопасности отображаются в репозитории объявлений. Breaking changes and security advisories are reported on the Announcements repo. Объявления можно ограничить определенной версией, выбрав фильтр меток. Announcements can be limited to a specific version by selecting a Label filter.

Прямая загрузка (текущая версия) Direct download (current version)

Скачайте установщик по следующей ссылке: Download the installer using the following link:

Требование к установке распространяемого компонента Visual C++ Visual C++ Redistributable Requirement

В старых версиях Windows Server 2012 R2 установите распространяемый компонент Visual Studio C++ 2015, 2017 или 2019. On older versions of Windows, for example Windows Server 2012 R2, install the Visual Studio C++ 2015, 2017, 2019 Redistributable. Если этого не сделать, в журнале событий Windows будет появляться непонятная ошибка The data is the error. Otherwise, a confusing error message in the Windows Event Log reports that The data is the error.

Более ранние версии установщика Earlier versions of the installer

Получение более ранней версии установщика: To obtain an earlier version of the installer:

  1. Перейдите на страницу загрузки .NET Core. Navigate to the Download .NET Core page.
  2. Выберите требуемую версию .NET Core. Select the desired .NET Core version.
  3. В столбце Запуск приложений — среда выполнения найдите строку, содержащую нужную версию среды выполнения .NET Core. In the Run apps — Runtime column, find the row of the .NET Core runtime version desired.
  4. Скачайте установщик по ссылке Hosting Bundle (Пакет размещения). Download the installer using the Hosting Bundle link.

Некоторые установщики содержат версии выпусков, которые достигли конца своего жизненного цикла и больше не поддерживаются корпорацией Майкрософт. Some installers contain release versions that have reached their end of life (EOL) and are no longer supported by Microsoft. Дополнительные сведения см. в разделе Политика поддержки. For more information, see the support policy.

Параметры Options

При запуске установщика из командной оболочки администратора доступны следующие параметры: The following parameters are available when running the installer from an administrator command shell:

  • OPT_NO_ANCM=1 . Пропуск установки модуля ASP.NET Core. OPT_NO_ANCM=1 : Skip installing the ASP.NET Core Module.
  • OPT_NO_RUNTIME=1 . Пропуск установки среды выполнения .NET Core. OPT_NO_RUNTIME=1 : Skip installing the .NET Core runtime. Используется, когда на сервере размещаются только автономные развертывания. Used when the server only hosts self-contained deployments (SCD).
  • OPT_NO_SHAREDFX=1 . Пропуск установки общей платформы ASP.NET (среды выполнения ASP.NET). OPT_NO_SHAREDFX=1 : Skip installing the ASP.NET Shared Framework (ASP.NET runtime). Используется, когда на сервере размещаются только автономные развертывания. Used when the server only hosts self-contained deployments (SCD).
  • OPT_NO_X86=1 . Пропуск установки сред выполнения x86. OPT_NO_X86=1 : Skip installing x86 runtimes. Этот параметр следует использовать, если вы наверняка не будете размещать 32-разрядные приложения. Use this parameter when you know that you won’t be hosting 32-bit apps. Если есть хоть малейшая возможность, что в будущем придется размещать и 32-разрядные, и 64-разрядные приложения, не указывайте этот параметр и установите обе среды выполнения. If there’s any chance that you will host both 32-bit and 64-bit apps in the future, don’t use this parameter and install both runtimes.
  • OPT_NO_SHARED_CONFIG_CHECK=1 . Отключение проверки использования общей конфигурации IIS, если файл общей конфигурации ( applicationHost.config ) находится на том же компьютере, что и установка IIS. OPT_NO_SHARED_CONFIG_CHECK=1 : Disable the check for using an IIS Shared Configuration when the shared configuration ( applicationHost.config ) is on the same machine as the IIS installation. Доступен только для пакетных установщиков размещения ASP.NET Core 2.2 или более поздней версии.Only available for ASP.NET Core 2.2 or later Hosting Bundler installers. Для получения дополнительной информации см. Модуль ASP.NET Core. For more information, see Модуль ASP.NET Core.
Читайте также:  Создаем рабочего стола для linux

Сведения об общей конфигурации IIS см. в разделе Модуль ASP.NET Core с общей конфигурацией IIS. For information on IIS Shared Configuration, see ASP.NET Core Module with IIS Shared Configuration.

Перезапустить IIS Restart IIS

После установки пакета размещения может потребоваться установить службы IIS вручную. After the Hosting Bundle is installed, a manual IIS restart may be required. Например, инструментарий CLI (команда) dotnet может не существовать по пути PATH для выполнения рабочих процессов служб IIS. For example, the dotnet CLI tooling (command) might not exist on the PATH for running IIS worker processes.

Чтобы вручную остановить и запустить службы IIS, выполните следующие команды в командной строке с повышенными разрешениями: To manually stop and start IIS, execute the following commands in an elevated command shell:

Версия модуля и журналы установщика хостинга Bundle Module version and Hosting Bundle installer logs

Чтобы определить версию установщика модуля ASP.NET Core, выполните следующие действия. To determine the version of the installed ASP.NET Core Module:

  1. В системе размещения перейдите к папке %PROGRAMFILES%\IIS\Asp.Net Core Module\V2 . On the hosting system, navigate to %PROGRAMFILES%\IIS\Asp.Net Core Module\V2 .
  2. Найдите файл aspnetcorev2.dll . Locate the aspnetcorev2.dll file.
  3. Щелкните правой кнопкой мыши файл и выберите Свойства из контекстного меню. Right-click the file and select Properties from the contextual menu.
  4. Выберите вкладку Сведения. Версия файла и Версия продукта дают представление об установленной версии модуля. Select the Details tab. The File version and Product version represent the installed version of the module.

Журналы установщика пакета размещения для модуля находятся в папке C:\Users\%UserName%\AppData\Local\Temp . The Hosting Bundle installer logs for the module are found at C:\Users\%UserName%\AppData\Local\Temp . Файл имеет имя dd_DotNetCoreWinSvrHosting___000_AspNetCoreModule_x64.log , где заполнитель — это метка времени файла. The file is named dd_DotNetCoreWinSvrHosting___000_AspNetCoreModule_x64.log , where the placeholder is the timestamp of the file.

Publish an ASP.NET Core app to IIS

This tutorial shows how to host an ASP.NET Core app on an IIS server.

This tutorial covers the following subjects:

  • Install the .NET Core Hosting Bundle on Windows Server.
  • Create an IIS site in IIS Manager.
  • Deploy an ASP.NET Core app.

Prerequisites

  • .NET Core SDK installed on the development machine.
  • Windows Server configured with the Web Server (IIS) server role. If your server isn’t configured to host websites with IIS, follow the guidance in the IIS configuration section of the Host ASP.NET Core on Windows with IIS article and then return to this tutorial.

IIS configuration and website security involve concepts that aren’t covered by this tutorial. Consult the IIS guidance in the Microsoft IIS documentation and the ASP.NET Core article on hosting with IIS before hosting production apps on IIS.

Important scenarios for IIS hosting not covered by this tutorial include:

  • Creation of a registry hive for ASP.NET Core Data Protection
  • Configuration of the app pool’s Access Control List (ACL)
  • To focus on IIS deployment concepts, this tutorial deploys an app without HTTPS security configured in IIS. For more information on hosting an app enabled for HTTPS protocol, see the security topics in the Additional resources section of this article. Further guidance for hosting ASP.NET Core apps is provided in the Host ASP.NET Core on Windows with IIS article.

Install the .NET Core Hosting Bundle

Install the .NET Core Hosting Bundle on the IIS server. The bundle installs the .NET Core Runtime, .NET Core Library, and the ASP.NET Core Module. The module allows ASP.NET Core apps to run behind IIS.

Download the installer using the following link:

Run the installer on the IIS server.

Restart the server or execute net stop was /y followed by net start w3svc in a command shell.

Create the IIS site

On the IIS server, create a folder to contain the app’s published folders and files. In a following step, the folder’s path is provided to IIS as the physical path to the app. For more information on an app’s deployment folder and file layout, see ASP.NET Core directory structure.

Читайте также:  Как удалить вирусы с папки windows

In IIS Manager, open the server’s node in the Connections panel. Right-click the Sites folder. Select Add Website from the contextual menu.

Provide a Site name and set the Physical path to the app’s deployment folder that you created. Provide the Binding configuration and create the website by selecting OK.

Top-level wildcard bindings ( http://*:80/ and http://+:80 ) should not be used. Top-level wildcard bindings can open up your app to security vulnerabilities. This applies to both strong and weak wildcards. Use explicit host names rather than wildcards. Subdomain wildcard binding (for example, *.mysub.com ) doesn’t have this security risk if you control the entire parent domain (as opposed to *.com , which is vulnerable). See rfc7230 section-5.4 for more information.

Confirm the process model identity has the proper permissions.

If the default identity of the app pool (Process Model > Identity) is changed from ApplicationPoolIdentity to another identity, verify that the new identity has the required permissions to access the app’s folder, database, and other required resources. For example, the app pool requires read and write access to folders where the app reads and writes files.

Create an ASP.NET Core Razor Pages app

Follow the Get started with ASP.NET Core tutorial to create a Razor Pages app.

Publish and deploy the app

Publish an app means to produce a compiled app that can be hosted by a server. Deploy an app means to move the published app to a hosting system. The publish step is handled by the .NET Core SDK, while the deployment step can be handled by a variety of approaches. This tutorial adopts the folder deployment approach, where:

  • The app is published to a folder.
  • The folder’s contents are moved to the IIS site’s folder (the Physical path to the site in IIS Manager).
  • Visual Studio
  • .NET Core CLI
  • Visual Studio for Mac
  1. Right-click on the project in Solution Explorer and select Publish.
  2. In the Pick a publish target dialog, select the Folder publish option.
  3. Set the Folder or File Share path.
    • If you created a folder for the IIS site that’s available on the development machine as a network share, provide the path to the share. The current user must have write access to publish to the share.
    • If you’re unable to deploy directly to the IIS site folder on the IIS server, publish to a folder on removable media and physically move the published app to the IIS site folder on the server, which is the site’s Physical path in IIS Manager. Move the contents of the bin/Release//publish folder to the IIS site folder on the server, which is the site’s Physical path in IIS Manager.
  4. Select the Publish button.
  1. In a command shell, publish the app in Release configuration with the dotnet publish command:

    Move the contents of the bin/Release//publish folder to the IIS site folder on the server, which is the site’s Physical path in IIS Manager.

  1. Right-click on the project in Solution and select Publish >Publish to Folder.
  2. Set the Choose a folder path.
    • If you created a folder for the IIS site that’s available on the development machine as a network share, provide the path to the share. The current user must have write access to publish to the share.
    • If you’re unable to deploy directly to the IIS site folder on the IIS server, publish to a folder on removeable media and physically move the published app to the IIS site folder on the server, which is the site’s Physical path in IIS Manager. Move the contents of the bin/Release//publish folder to the IIS site folder on the server, which is the site’s Physical path in IIS Manager.
  3. Select the Publish button.

Browse the website

The app is accessible in a browser after it receives the first request. Make a request to the app at the endpoint binding that you established in IIS Manager for the site.

Оцените статью