Posts related to: IIS
Lost ASP.NET Identity Cookies on IIS Application Pool Restarts
If you find that your ASP.NET authentication cookies expire every time your IIS application pool restarts or recycles, the culprit is likely the DataProtection API not finding the previously stored keys. This post describes one gotcha I ran into with the default storage location on IIS in the user profile due to a default Application Pool setting.
Running ASP.NET Core Applications as a Subfolder Application
While ASP.NET Core applications typically run from the root folder, some scenarios—such as hosting multiple blogs under a single domain—require running from a subfolder. This post explains how to configure ASP.NET Core with app.UsePathBase() for proper routing and ~/ path resolution, along with the IIS setup required for a dedicated Application Pool using "No Managed Code." It also covers key migration tips, including bulk updates for root-relative links and JavaScript adjustments to keep client-side functionality working in a subfolder environment.
ASP.NET Core Hosting Module with Shadow Copy Not Starting: Separate your Shadow Copy Folders!
I recently ran into a major failure related to Shadow Copying for an ASP.NET Web app on IIS which was caused by corruption of the Shadow Copy directories. The app starts with the dreaded white ANCM Error page and event log entries that point at missing application folders. It turns out that this is caused by interference of multiple applications using the same shadow copy folder. In this post I describe the problem and how to work around it.
Locked Files When Publishing .NET Core Apps to IIS with WebDeploy
When using Visual Studio's Publish Web Site feature with ASP.NET Core you may get frustrating errors when publishing to already running sites as files on the server are locked and can't be updated until the site is shutdown. Turns out the default settings don't unload the application before publising, but there's a simple solution to unload before publishing and the restart the application.
Windows Authentication and Account Caching on Web Browser Auto-Logins
If you're working with Windows authentication to access Windows or Active Directory groups be aware that there's a gotcha with newly added groups when users are automatically logged into the Web browser.
ASP.NET Core In Process Hosting on IIS with ASP.NET Core
In version 2.2 ASP.NET Core adds support for direct in-process hosting which improves throughput considerably using an easy mechanism that allows switching between in-process and out-of-process hosting. In this post I describe how to use in process hosting and how it works.
Configuring LetsEncrypt for ASP.NET Core and IIS
LetsEncrypt makes it easy to create SSL certificates for your applications for free and lets you automate the process. When using LetsEncrypt with IIS and ASP.NET Core however a few extra steps are required to make an ASP.NET Core site work with LetsEncrypt. I show you how in this post.
Handling HTML5 Client Route Fallbacks in ASP.NET Core
HTML5 client routes work great on the client, but when deep linking into a site or pressing refresh in the browser, HTML5 client side routes have a nasty habit of turning into server HTTP requests. Requests to routes that the server is likely not configured for. In this post I look at why HTML5 client routes require server cooperation to handle and how to set them up on IIS and/or ASP.NET Core.
Bypassing IIS Error Messages in ASP.NET
IIS Error handling is the source of lots of confusion. I've been using IIS for nearly 20 years now, and figuring out the right combination of error configuration settings and code to properly serve custom error pages or error responses in API still makes fumble a few times before I get it just right. This post provides a few hints and some background on how to deal with error handling.
Automating IIS Feature Installation with Powershell
IIS often gets a bad wrap for being diffcult to install and configure. However, using some of the built-in tooling for administration using PowerShell it's actually quite easy to configure IIS and even set up a new site and application pool with a few short scripts that are much quicker, and more repeatable than using the various Windows UI features. Here's how.
IIS and ASP.NET Core Rewrite Rules for Static Files and Html 5 Routing
If you're running ASP.NET Core under Windows with IIS, you'll want to take advantage of letting IIS serve up your static content and handle your HTML 5 Client and home routes. IIS is very efficient at handling static content and content re-routing and in this post I describe how you can properly configure ASP.NET Core applications using the AspNetCoreModule and IIS Rewrite Rules
More on ASP.NET Core Running under IIS
Since my last post about hosting ASP.NET Core on IIS I've gotten quite a few questions and comments in regards to working with this mixed IIS/Kestrel hosting environment. There are quite a few not so obvious arrangement in this set up and some surprising discoveries in terms of performance and segragation of feature usage between IIS and Kestrel.
External Network Access to Kestrel and IIS Express in ASP.NET Core
Recently I needed to connect to my Windows based ASP.NET Core API from my Mac and in order for that to work some configuration settings are necesary so that the ASP.NET applications can serve HTTP content to the external network connection that this entails. In this post I show what you have to do to enable remote connections both using the Kestrel and IIS Express Web servers.
ASP.NET Web Site Project Publishing and Changing ACLs
When publishing ASP.NET Web Site Projects, the project publish will overwrite server ACLs by clearing them to the inherited defaults and removing rights from common accounts. The result is that if you have custom ACLs set on the server they will be wiped by default. This occurs only on Web Site projects and in this post I remind myself of the .pubxml override setting that disables this default behavior
Use Powershell to bind SSL Certificates to an IIS Host Header Site
Managing SSL certificates on Windows has always been a pain in the ass and recently with the introduction of SNI to support multiple SSL certificates per site things have changed slightly in order to register certificates with IIS programmatically. In this post I show how to use PowerShell and the IIS WebAdministration snap in commands to create or import and register an SSL Certificate via the Command Line along with how this convoluted process works