简体   繁体   English

确定安装的 ASP.NET Core Hosting Bundle 版本

[英]Determine installed ASP.NET Core Hosting Bundle versions

I've looked around a bit on how to get the versions of the installed ASP.NET Core Hosting Bundles.我已经查看了有关如何获取已安装 ASP.NET 核心托管捆绑包的版本的一些信息。 I know that the "Bundle" consists of the ASP.NET Core Module(V2) for IIS, and the .NET Core Runtime itself.我知道“捆绑包”由 IIS 的 ASP.NET 核心模块(V2)和 .NET 核心运行时本身组成。

The Problem is, that I have a ASP.NET Core 2.1 and a ASP.NET Core 3.1 app that need to run on the very same IIS, which is why I need to know if both "bundles" are installed.问题是,我有一个 ASP.NET Core 2.1 和一个 ASP.NET Core 3.1 应用程序,它们需要在同一个 IIS 上运行,这就是我需要安装的原因。 Most answers around here focus on the .NET Core runtime itself and end on dotnet --info or dotnet --list-runtimes which shows me all the installed runtimes, but iin case of --info only the highest installed "host".这里的大多数答案都集中在 .NET Core 运行时本身,并以dotnet --infodotnet --list-runtimes结束,它显示了所有已安装的运行时,但在--info的情况下,仅安装了最高的“主机”。

Since some older answers center around the path that dotnet is installed in, I looked that one up, and to my surprise, within %ProgramFiles%\dotnet there is a host folder contianing subfolders with the versions of the bundles that were installed.由于一些较旧的答案以安装 dotnet 的路径为中心,因此我查看了一个,令我惊讶的是,在%ProgramFiles%\dotnet中有一个host文件夹,其中包含已安装的捆绑包版本的子文件夹。 Within each is a hostfxr.dll .每个里面都有一个hostfxr.dll

So my question is, can I determine by that folder structure which versions of the ASP.NET Core Hosting bundles were installed?所以我的问题是,我能否通过该文件夹结构确定安装了哪些版本的 ASP.NET 核心托管捆绑包?

As it seems, that folder path has nothing to do with the hosting package.看起来,该文件夹路径与托管 package 无关。

But what's more important, an IIS that was installed after .NET Core doesn't seem to recognize the AspNetCoreModule(V2) at all.但更重要的是,在 .NET Core 之后安装的 IIS 似乎根本无法识别 AspNetCoreModule(V2)。 This means, that I always need to install the hosting package, no matter if the IIS is present or not, just to be sure.这意味着,我总是需要安装主机 package,不管 IIS 是否存在,只是为了确定。

The path to the Asp.Net Core Module v2 module is: Asp.Net Core Module v2 模块的路径是:

%Program Files%\IIS\Asp.Net Core Module\V2

The install order of hosting bundles doesn't matter, you can install 5.0 then 3.1 then 2.1 in that order and the module version will be the latest major version from the newest bundle (in this example from 5.0 it will be v15.x)托管捆绑包的安装顺序无关紧要,您可以按该顺序安装 5.0 然后 3.1 然后 2.1,模块版本将是最新捆绑包中的最新主要版本(在此示例中,来自 5.0 的它将是 v15.x)

  • Installing a newer major version of the hosting bundle will update the module安装更新的主要版本的托管包将更新模块
  • Installing a older major version of the hosting bundle will not update or replace the module if an existing newer major version already installed如果已安装现有的较新主要版本,则安装较旧的托管捆绑包的主要版本不会更新或替换模块

The module is backwards compatible as far as I can tell.据我所知,该模块向后兼容。 The v15.x module installed by the 5.x hosting bundle works for 3.x, 2.x and 1.x 5.x 托管捆绑包安装的 v15.x 模块适用于 3.x、2.x 和 1.x

The version numbers are aligned, 3.x installs module v13.x, 5.x installs module v15 and 6.x installs module 16.x etc.版本号对齐,3.x 安装模块 v13.x,5.x 安装模块 v15,6.x 安装模块 16.x 等。

The command to list the runtimes installed is:列出已安装运行时的命令是:

dotnet --list-runtimes

You can view commits affecting the v2 module here https://github.com/dotnet/aspnetcore/commits/main/src/Servers/IIS/AspNetCoreModuleV2您可以在此处查看影响 v2 模块的提交https://github.com/dotnet/aspnetcore/commits/main/src/Servers/IIS/AspNetCoreModuleV2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM