2016-07-25 35 views
8

我設置了各種Windows服務器來託管asp.net核心應用程序,並且我需要能夠確定他們是否擁有asp.net託管捆綁安裝。如何確定asp.net核心是否已安裝在Windows服務器上

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

在服務器上的「安裝.NET核心Windows服務器託管束 束將安裝.NET核心運行時,.NET核心庫,並 的ASP.NET核心Module。該模塊創建 IIS和Kestrel服務器之間的反向代理。「

我正在建立一個部署,我需要確保我的服務器已配置,以便我可以運行asp.net核心應用程序。

我正在尋找,基本上,一個註冊表項或其他方式告訴我,如果我應該運行安裝程序設置。 (有點像,如果安裝了舊版本的框架中,我們會告訴的方式,像 https://support.microsoft.com/en-us/kb/318785 確實爲早期版本)

回答

6

您可以在下搜索Microsoft .NET Core 1.1.1 - Windows Server Hosting註冊表項像下面的截圖一樣。你

enter image description here

也可以使用PowerShell來確定是否存在與否的關鍵。

$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" 
} 

而且你可以從How to determine ASP.NET Core installation on a Windows Server by PowerShell下載樣本。

2

如果你被允許引進的限制,一個選擇是隻允許「自足應用程序「,因爲它們不需要任何額外的安裝。這也使得諸如「安裝什麼版本」等問題消失。

如果您需要支持「便攜式應用程序」你可以簡單地執行以下操作以檢查dotnet.exe可用:

where dotnet

然後,您可以檢查版本:

dotnet --version

這也可以讓你檢查.NET Core的版本,一旦成爲一個問題。

0

你可以看一下

HKEY_LOCAL_MACHINE \ SOFTWARE \ Wow6432Node \微軟\的Windows \ CurrentVersion \卸載{ab4f6e29-67a1-47d9-b2ab-43348a9bbae4}

,並確保「微軟.NET Core 1.0.0 - Windows Server Hosting「

+2

這隻會檢測到使用了特定的安裝程序......可能在下次更新可用時不再有效。 –

+0

這是正確的,我認爲它將與檢測遺留.net版本一樣工作:您在註冊表中尋找特定版本的框架的特定鍵。 – weloytty

0

您還可以雙擊DotNetCore.1.0.1-WindowsHosting.exe
如果已安裝.NET Core Windows Server Hosting軟件包,則t他打開窗戶將有:

  1. 修改安裝標籤
  2. 修復和卸載按鈕

修復和卸載按鈕和修改安裝標籤。
Microsoft .NET Core 1.0.1 - Windows Server Hosting Setup already installed

2

如果你想在遠程會話做替代首先你可以使用PowerShell來檢查,如果託管模塊與IIS

註冊

在本地PowerShell會話

Import-module WebAdministration 
$vm_dotnet_core_hosting_module = Get-WebGlobalModule | where-object { $_.name.ToLower() -eq "aspnetcoremodule" } 
if (!$vm_dotnet_core_hosting_module) 
{ 
    throw ".Net core hosting module is not installed" 
} 

2與

Invoke-Command -Session $Session {Import-module WebAdministration} 
$vm_dotnet_core_hosting_module = Invoke-Command -Session $Session {Get-WebGlobalModule | where-object { $_.name.ToLower() -eq "aspnetcoremodule" }} 
+0

我喜歡這個答案,但是在64位版本和32位版本的PowerShell中, – BozoJoe

相關問題