如何确定Windows服务器上是否已安装asp.net核心 [英] How to determine if asp.net core has been installed on a windows server

查看:335
本文介绍了如何确定Windows服务器上是否已安装asp.net核心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设置各种Windows服务器来托管asp.net核心应用程序,并且我需要确定它们是否安装了asp.net托管包。





此外,您还可以使用PowerShell来确定密钥是否存在。

  $ DotNETCoreUpdatesPath = Registry :: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft \更新\.NET Core 
$ DotNetCoreItems = Get-Item -ErrorAction停止-Path $ DotNETCoreUpdatesPath
$ NotInstalled = $ True
$ DotNetCoreItems.GetSubKeyNames()|其中{$ _-匹配 Microsoft .NET Core。* Windows服务器托管} | ForEach-Object {
$ NotInstalled = $ False
写主机主机已安装$ _
}
If($ NotInstalled){
写主机找不到主机上安装的ASP.NET Core
}

您可以从如何通过PowerShell确定Windows Server上ASP.NET Core的安装示例


I'm setting up various windows servers to host asp.net core apps, and I need to be able to determine if they have the asp.net hosting bundle installed.

https://docs.asp.net/en/latest/publishing/iis.html#install-the-net-core-windows-server-hosting-bundle says:

"Install the .NET Core Windows Server Hosting bundle on the server. The bundle will install the .NET Core Runtime, .NET Core Library, and the ASP.NET Core Module. The module creates the reverse-proxy between IIS and the Kestrel server."

I'm setting up a deployment, and I need to make sure my server is configured so I can run asp.net core apps.

I'm looking, basically, for a registry key or some other way to tell me if I should run the installer setup. (something like the way we'd tell if older versions of the framework are installed, like https://support.microsoft.com/en-us/kb/318785 does for earlier versions)

解决方案

You can search Microsoft .NET Core 1.1.1 - Windows Server Hosting registry key under HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Updates\.NET Core path like screenshot below.

Also you can use PowerShell to determine the whether the key existed or not.

$DotNETCoreUpdatesPath = "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Updates\.NET Core"
$DotNetCoreItems = Get-Item -ErrorAction Stop -Path $DotNETCoreUpdatesPath
$NotInstalled = $True
$DotNetCoreItems.GetSubKeyNames() | Where { $_ -Match "Microsoft .NET Core.*Windows Server Hosting" } | ForEach-Object {
    $NotInstalled = $False
    Write-Host "The host has installed $_"
}
If ($NotInstalled) {
    Write-Host "Can not find ASP.NET Core installed on the host"
}

And you can download sample from How to determine ASP.NET Core installation on a Windows Server by PowerShell.

这篇关于如何确定Windows服务器上是否已安装asp.net核心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆