Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine if asp.net core has been installed on a windows server

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)

like image 748
weloytty Avatar asked Jul 25 '16 12:07

weloytty


People also ask

Where is ASP.NET installed?

If ASP.NET 3.5 or 4.5 are installed, in the list of Roles they will be located under Web Server (IIS) > Web Server > Application Development.


Video Answer


2 Answers

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.

enter image description here

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.

like image 125
Eric Avatar answered Sep 17 '22 14:09

Eric


You can use powershell to check if the hosting module is registered with IIS

In the local powershell session

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

If you want to do in the remote session replace first 2 lines with

Invoke-Command -Session $Session {Import-module WebAdministration} $vm_dotnet_core_hosting_module = Invoke-Command -Session $Session {Get-WebGlobalModule | where-object { $_.name.ToLower() -eq "aspnetcoremodule" }} 
like image 40
Alex Filenkov Avatar answered Sep 19 '22 14:09

Alex Filenkov