Learn MS NET | Windows Server

Our journey learning how to write .NET

Learn MS NET

  • Join Us on Facebook!
  • Follow Us on Twitter!
  • LinkedIn
  • Subcribe to Our RSS Feed

How to update a Docker container to the latest version


Having needed to update some Docker containers and getting familiar with how Docker works I though I would post this here so I have it for reference and if anyone else is looking to do the same thing.On my installation of docker I run DotNet Core in containers and with each new update to the SDK new containers get published and it becomes necessary to update them every month or so.As we can see on my installation at the moment the 2.2 versions are 4 months old PS C:\WINDOWS\system32> docker images | findstr "dotnet" mcr.microsoft.com/dotnet/core/sdk 3.0-buster 3930ade3a33a 4 days ago 695MB mcr.microsoft.com/dotnet/core/aspnet 3.0-buster-slim 1d97a08ada5a 4 days ago 207MB mcr.microsoft.com/dotnet/core/sdk <none> 4e9e8dec2900 3 weeks ago 707MB mcr.microsoft.com/dotnet/core/aspnet <none> de4e4dcb9041 3 weeks ago 196MB mcr.microsoft.com/dotnet/core/sdk 2.2 e268893be733 4 months ago 1.74GB mcr.microsoft.com/dotnet/core/sdk 2.2-stretch e268893be733 4 months ago 1.74GB mcr.microsoft.com/dotnet/core/aspnet 2.2-stretch-slim cb2dd04458bc 4 months ago 260MB microsoft/dotnet 2.1-aspnetcore-runtime a5f99632e68d 4 months ago 253MB mcr.microsoft.com/dotnet/core/aspnet 2.2 df2a085ca3a8 4 months ago 260MB In order to update the container and make sure they are the latest version, I ran pull: PS C:\WINDOWS\system32> docker pull mcr.microsoft.com/dotnet/core/sdk:2.2 2.2: Pulling from dotnet/core/sdk 9cc2ad81d40d: Pull complete e6cb98e32a52: Pull complete ae1b8d879bad: Pull complete 42cfa3699b05: Pull complete dcc190332ff6: Pull complete b49aea48d777: Pull complete 67e832fd5d6a: Pull complete Digest: sha256:e1b19d391986f21b177c1ba47f8a8519bf5cff66a9459d04f3aea23e1a7ec30f Status: Downloaded newer image for mcr.microsoft.com/dotnet/core/sdk:2.2 mcr.microsoft.com/dotnet/core/sdk:2.2 Now I have an update container for version 2.2 of the DotNet Core SDK PS C:\WINDOWS\system32> docker images | findstr "dotnet" mcr.microsoft.com/dotnet/core/sdk 2.2 08657316a4cd 4 days ago 1.74GB This will update the container that is located locally and if you were having any problems simply restart any container that uses that particular container to gain the latest version. The concludes the update of the container.

HTTP Error 500.30–ANCM In-Process Start Failure


While preparing an app to run on my local IIS server for the first time I received this error. It provides some clues as to what is happening but does not give a direct cause and can be very frustrating when trying to get that app ready for production.HTTP Error 500.30 - ANCM In-Process Start FailureCommon causes of this issue:The application failed to start The application started but then stopped The application started but threw an exception during startupTroubleshooting steps:Check the system event log for error messages Enable logging the application process' stdout messages Attach a debugger to the application process and inspectFor more information visit: https://go.microsoft.com/fwlink/?LinkID=2028265The page that we receive here basically takes us to the standard installation for the ASP.NET Core Module, which may be a good place to start to see if there was a misconfiguration when the module was installed.Now if the issue continues there are some ways to determine what the issue isCheck Application Event LogAccess the Application Event Log:Open the Start menu, search for Event Viewer, and then select the Event Viewer app. In Event Viewer, open the Windows Logs node. Select Application to open the Application Event Log. Search for errors associated with the failing app. Errors have a value of IIS AspNetCore Module or IIS Express AspNetCore Module in the Source column.Run the app at a command promptMany start-up errors don’t produce much useful information in the Application Event Log. Another option is to run the app at a command prompt on the hosting system if there is access to do that.Framework-dependent deploymentIf the app is deployed as framework-dependent:At a command prompt or PowerShell window, navigate to the folder that contains the app and launch the app by executing the assembly with dotnet.exe. dotnet .\<assembly_name>.dll – substitute <assembly_name> with the name of the applicationIn the console window, if there are any errors they will written in the output.If the errors only occur when making a request to the app, launch a browser and make a request to the app. Usually this will be at http://localhost:5000/. If the app responds normally with no error, the problem more likely related to the hosting configuration and not the app.Self-contained deploymentIf the app is deployed as self-contained then follow the above steps substituting <assembly_name>.exe for dotnet .\<assembly_name>.dll and follow the rest of the steps.ASP.NET Core Module stdout logTo enable and view stdout logs:Navigate to the app folder on the host system.If the logs folder isn’t present create the folder.Edit the web.config file. Set stdoutLogEnabled to true and change the stdoutLogFile path to point to the logs folder (for example: .\logs\stdout) stdout in the path is the log file name prefix.Ensure your application pool’s identity has write permissions to the logs folder.Save the updated web.config file.Make a request to the app or site.Look in the logs folder and find the latest log file.Check the file for errors.Once trouble shooting is complete make sure to turn off logging in the web.config file by setting stdoutLogEnabled to falseHopefully this helps solve your issue.

How to serve files without extensions in IIS


By default, IIS will not serve up files without an extension. Never the less sometimes we need to allow IIS to serve up these files.The following web.config file can be placed in the directory that you want to serve up these files from.<?xml version="1.0" encoding="UTF-8"?>    <configuration>         <system.webServer>             <staticContent>                 <clear />                 <mimeMap fileExtension="." mimeType="*/*" />             </staticContent>         </system.webServer></configuration>The mimeType can be adjusted to allow a specific type of file to be downloaded from the server as well.