.NET C# Java Javascript Exception


The problem

Let’s say you have a ASP.NET Core application without the bundled ASP.NET Core runtime (e.g. to keep the download as small as possible) and you want to run your ASP.NET Core application on a Windows Server hosted by IIS.

General approach

The general approach is the following: Install the .NET Core hosting bundle and you are done.

Each .NET Core Runtime (and there are quite a bunch of them) is backward compatible (at least the 2.X runtimes), so if you have installed 2.2.6, your app (created while using the .NET runtime 2.2.1), still runs.

Why check the minimum version?

Well… in theory the app itself (at least for .NET Core 2.X applications) may run under runtime versions, but each version might fix something and to keep things safe it is a good idea to enforce security updates.

Check for minimum requirement

I stumbled upon this Stackoverflow question/answer and enhanced the script, because that version only tells you “ASP.NET Core seems to be installed”. My enhanced version searchs for a minimum required version and if this is not installed, it exit the script.

$DotNetCoreMinimumRuntimeVersion = [System.Version]::Parse("")

$DotNETCoreUpdatesPath = "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Updates\.NET Core"
$DotNetCoreItems = Get-Item -ErrorAction Stop -Path $DotNETCoreUpdatesPath
$MinimumDotNetCoreRuntimeInstalled = $False

$DotNetCoreItems.GetSubKeyNames() | Where { $_ -Match "Microsoft .NET Core.*Windows Server Hosting" } | ForEach-Object {

 $registryKeyPath = Get-Item -Path "$DotNETCoreUpdatesPath\$_"

 $dotNetCoreRuntimeVersion = $registryKeyPath.GetValue("PackageVersion")

 $dotNetCoreRuntimeVersionCompare = [System.Version]::Parse($dotNetCoreRuntimeVersion)

 if($dotNetCoreRuntimeVersionCompare -ge $DotNetCoreMinimumRuntimeVersion) {
 Write-Host "The host has installed the following .NET Core Runtime: $_ (MinimumVersion requirement: $DotNetCoreMinimumRuntimeVersion)"
 $MinimumDotNetCoreRuntimeInstalled = $True

if ($MinimumDotNetCoreRuntimeInstalled -eq $False) {
 Write-host ".NET Core Runtime (MiniumVersion $DotNetCoreMinimumRuntimeVersion) is required." -foreground Red

The “most” interesting part is the first line, where we set the minimum required version.

If you have installed a version of the .NET Core runtime on Windows, this information will end up in the registry like this:

Now we just need to compare the installed version with the existing version and know if we are good to go.

Hope this helps!

.net web csharp asp.net javascript html5 asp.net-mvc jquery css iis
5 Meinungen
It is a good and amazing article. Your information is very useful for me and for others. Thank you so much.
hotmail login
Many students find essay writing complicated and complex task. If you are one of them, you should remember that on this website you will get help connected with essay writing.https://mid-terms.com/answer-my-test-questions/
have a nice day. a good working day
gmail login
Things are very open and intensely clear explanation of issues. was truly information. Your website is very beneficial
hotmail login email
gmail sign up
Eastern Oklahoma Dental Care is a proficient dental care service who are knowledgeable about providing clinically verified care in a welcoming and relaxed atmosphere. With the experience and expertise, they are capable of upholding an excellent level of dental care and services Best Cosmetic Dentist Near Me.
Schreibe einen Kommentar:
iis css jquery asp.net-mvc html5 javascript asp.net csharp web .net
Entweder einloggen... ...oder ohne Wartezeit registrieren
Passwort wiederholen