C#

发布到ASP.NET CORE项目到 Windows server 2012

Posted by Zeusro on January 17, 2018
👈🏻 Select language

装软件

  • .NET Core Windows Server 托管捆绑包

ASP.NET Core 模块是一个 IIS 7.5+ 模块,它负责 ASP.NET Core HTTP 侦听器的进程管理,并将请求代理到它所管理的进程。 目前,为 IIS 安装 ASP.NET Core 模块的过程为手动操作。 需要在常规(而不是 Nano)计算机上安装 .NET Core Windows Server 托管捆绑包

  • 安装补丁

Update for Universal C Runtime in Windows

  • 其他配置
  1. 环境变量ASPNETCORE_ENVIRONMENT,设置为Production,表示该服务器读取的是生产环境 appsettings.Development.json的配置

源代码发布

1
2
3
4
5
6
7
8
9
10
11
dotnet publish E:\xxx\project.csproj 
/p:PublishProfile="E:\xxx\Properties\PublœishProfiles\jenkins.pubxml" 
/p:Configuration=Release 
-o E:\jenkins 
-v detailed  
--force 
-c Release 
-r win8-x64

# 简化命令
# dotnet publish -c Release -r win8-x64 -o E:\jenkins 

IIS配置

参考链接里面说的很清楚了,主要就是设置应用程序池为无托管代码即可,把编译出来的目录作为 web 目录就行了,出现问题的按Troubleshoot那个链接处理

参考链接:

  1. .NET Core RID 目录
  2. Host ASP.NET Core on Windows with IIS
  3. Amazing ASP.NET Core 2.0
  4. 使用 IIS 在 Windows 上托管 ASP.NET Core
  5. dotnet 发布
  6. ASP.NET Core Module configuration reference
  7. Troubleshoot ASP.NET Core on IIS
  8. Visual Studio publish profiles for ASP.NET Core app deployment
  9. 使用多个环境 10.

Install Software

  • .NET Core Windows Server Hosting Bundle

The ASP.NET Core module is an IIS 7.5+ module that handles process management for the ASP.NET Core HTTP listener and proxies requests to the processes it manages. Currently, installing the ASP.NET Core module for IIS is a manual process. You need to install the .NET Core Windows Server Hosting Bundle on a regular (not Nano) computer.

  • Install Patches

Update for Universal C Runtime in Windows

  • Other Configuration
  1. Environment variable ASPNETCORE_ENVIRONMENT, set to Production, indicating that the server reads the production environment configuration from appsettings.Development.json

Source Code Publishing

1
2
3
4
5
6
7
8
9
10
11
dotnet publish E:\xxx\project.csproj 
/p:PublishProfile="E:\xxx\Properties\PublœishProfiles\jenkins.pubxml" 
/p:Configuration=Release 
-o E:\jenkins 
-v detailed  
--force 
-c Release 
-r win8-x64

# Simplified command
# dotnet publish -c Release -r win8-x64 -o E:\jenkins 

IIS Configuration

The reference links explain it very clearly. The main thing is to set the application pool to “No Managed Code”, and use the compiled directory as the web directory. If problems occur, refer to the Troubleshoot link for handling.

  1. .NET Core RID Catalog
  2. Host ASP.NET Core on Windows with IIS
  3. Amazing ASP.NET Core 2.0
  4. Host ASP.NET Core on Windows with IIS
  5. dotnet publish
  6. ASP.NET Core Module configuration reference
  7. Troubleshoot ASP.NET Core on IIS
  8. Visual Studio publish profiles for ASP.NET Core app deployment
  9. Use multiple environments 10.

Установка программного обеспечения

  • .NET Core Windows Server Hosting Bundle

Модуль ASP.NET Core — это модуль IIS 7.5+, который обрабатывает управление процессами для HTTP-слушателя ASP.NET Core и проксирует запросы к процессам, которыми он управляет. В настоящее время установка модуля ASP.NET Core для IIS является ручным процессом. Необходимо установить .NET Core Windows Server Hosting Bundle на обычном (не Nano) компьютере.

  • Установка патчей

Update for Universal C Runtime in Windows

  • Другая конфигурация
  1. Переменная окружения ASPNETCORE_ENVIRONMENT, установленная в Production, указывает, что сервер читает конфигурацию производственной среды из appsettings.Development.json

Публикация исходного кода

1
2
3
4
5
6
7
8
9
10
11
dotnet publish E:\xxx\project.csproj 
/p:PublishProfile="E:\xxx\Properties\PublœishProfiles\jenkins.pubxml" 
/p:Configuration=Release 
-o E:\jenkins 
-v detailed  
--force 
-c Release 
-r win8-x64

# Упрощенная команда
# dotnet publish -c Release -r win8-x64 -o E:\jenkins 

Конфигурация IIS

Ссылки для справки объясняют это очень четко. Главное — установить пул приложений на “No Managed Code” и использовать скомпилированную директорию в качестве веб-директории. Если возникают проблемы, обратитесь к ссылке Troubleshoot для решения.

Ссылки:

  1. Каталог .NET Core RID
  2. Размещение ASP.NET Core в Windows с IIS
  3. Amazing ASP.NET Core 2.0
  4. Размещение ASP.NET Core в Windows с IIS
  5. dotnet publish
  6. Справочник по конфигурации модуля ASP.NET Core
  7. Устранение неполадок ASP.NET Core в IIS
  8. Профили публикации Visual Studio для развертывания приложения ASP.NET Core
  9. Использование нескольких сред 10.


💬 讨论 / Discussion

对这篇文章有想法?欢迎在 GitHub 上发起讨论。
Have thoughts on this post? Start a discussion on GitHub.

在 GitHub 参与讨论 / Discuss on GitHub