Quote of the Day

more Quotes

Categories

Get notified of new posts

Buy me coffee

All posts in "IIS"

About integrated windows authentication and how to implement it in ASP.NET core running on IIS.

Published June 27, 2020 in .NET core , Angular , IIS , security - 4 Comments

In this post, I share what I have learned about integrated windows authentication and how to enable it in a web application which consists of an angular front-end and ASP.NET core 3 backend.

Continue reading

How to resolve “An exception was forcibly closed by the remote host” in a .NET app running on an azure VM behind a load balancer.

Published June 14, 2020 in Azure , IIS , Networking - 0 Comments

I get the error “An exception was forcibly closed by the remote host” occasionally at work. This is an I.O exception and happens when a HTTP request fails to reach the destination host. To troubleshoot, I often ping or tracert the destination IP/URL, and the error usually comes down to the firewall restricting the connection, and goes away once we have updated the firewall to handle the connection. However, another instance when I get this error is when my app that runs on an azure VM of a load balancer tries to send a request to another app which has a DNS that points to the same load balancer.

Continue reading

Access azure key vault from an ASP.NET core app on IIS using X.509 certificate

In this post, I go over in more details the steps of retrieving secrets from an azure key vault using client id and secret. This approach is one of the three ways to authenticate a Windows virtual machine against azure key vault. It is suitable if your app runs on a virtual machine which is not an azure resource and so cannot use azure managed identity.

At the high level, the process involves these steps:

  • Register the application in azure.
  • Generate and add a X.509 certificate into a certificate store.
  • Grant IIS_IUSRS user permission to access the private key of the certificate.
  • Upload the public key of the certificate to the app’s registration.
  • Grant the app access to the key vault.
  • Add codes to Startup file to authenticate against AD using the certificate.

You can find the sample project for this post here.

Continue reading

Build and deploy an ASP.NET core app running on IIS using Azure pipelines

Published August 15, 2019 in ASP.NET core , Azure , Devops , IIS - 1 Comment

This is part III of the series in which I cover how to build and deploy an ASP.NET core app to IIS running on a Windows VM. In part I, I cover how to build and publish an artifact using visual studio. In part II, I cover how to manually deploy the artifact to IIS and go over some of the concepts such as bindings, app pools and website.

In this tutorial, I walks you through the steps to automate the build and deployment process using azure pipelines.

Continue reading

Deploy an ASP.NET core application to IIS on Windows Server 2019.

Published March 16, 2019 in ASP.NET core , Devops , IIS - 4 Comments

This is part II of the blog post series in which I share some of ways to build and deploy an ASP.NET core application to IIS running on a Windows VM. In the previous post, I cover how to build and published an ASP.NET core application. The end result is an artifact (a published directory). In this post, I go over how to deploy the artifact to IIS. Along the way, we’ll discuss:

  • Enabling IIS
  • .NET core runtime and hosting bundle
  • IIS website and application configuration
  • IIS application pool

Continue reading

How to auto start and keep an ASP.NET core web application running on IIS

Published October 7, 2018 in ASP.NET core , IIS - 26 Comments

I have an ASP.NET core web application which hosts a background task via the IHosedService interface. I wrote about it in this post, if you want more info. The task needs to run continuously to poll for messages on an azure queue storage every 5 seconds. I have learned the default settings on IIS do not start the application until it receives the first request. Additionally, if the application has not received a request after a predefined period of time, IIS kills the application.

I could have hosted the application as a Windows service or converted the application into a console application and use the Windows scheduler to have it run continuously. However, I find hosting on a real IIS server convenient and beneficial since we already have other applications running on IIS and we can access the application via HTTP.

In this post, I share how I make the application to auto start and always run on IIS.

If you have an ASP.NET or an ASP.NET core which hosts a background job that needs to always run, want to preload the application for performance instead of waiting for the initial request to hit the app, or just get some tips on IIS, then read on.

Continue reading