Aspnetcore.docs: New Topic: Using IIS Modules with ASP.NET Core

Created on 10 Dec 2016  路  11Comments  路  Source: dotnet/AspNetCore.Docs

This question has reoccurred to me due to Response Compression, Response Caching, and URL Rewriting middlewares hitting the scene.

Some IIS modules can process requests/responses with the reverse-proxy setup and others don't work. For example, IIS Dynamic Compression (DynamicCompressionModule) works, while IIS Static Compression (StaticCompressionModule) doesn't work.

Should we provide a pair of lists in the Publish to IIS doc (or the ANCM Configuration Reference doc) that shows which IIS modules work and which ones don't work?

Reference List: https://www.iis.net/learn/get-started/introduction-to-iis/iis-modules-overview

All 11 comments

Sounds like good content to have. I'm not sure the Publish to IIS doc is really the right place though. I definitely wouldn't put it in the ANCM Config Reference. Maybe a separate topic? We really need to rework the TOC for hosting and publishing.

Call it IIS modules that work with ASP.NET Core.

Or maybe "Using IIS Modules with ASP.NET Core"?

Native Modules

Module | Works | ASP.NET Core Option
--- | :---: | ---
Anonymous Authentication
AnonymousAuthenticationModule | Yes |
Basic Authentication
BasicAuthenticationModule | Yes |
Client Certification Mapping Authentication
CertificateMappingAuthenticationModule | ? (1) |
CGI
CgiModule | No |
Configuration Validation
ConfigurationValidationModule | Yes* |
HTTP Errors
CustomErrorModule | No* | Status Code Pages Middleware
fundamentals/error-handling#configuring-status-code-pages
Custom Logging
CustomLoggingModule | Yes |
Default Document
DefaultDocumentModule | No* | Default Files Middleware
fundamentals/static-files#serving-a-default-document
Digest Authentication
DigestAuthenticationModule | Yes |
Directory Browsing
DirectoryListingModule | No* | Directory Browsing Middleware
fundamentals/static-files#enabling-directory-browsing
Dynamic Compression
DynamicCompressionModule | Yes* | Response Compression Middleware
fundamentals/response-compression
Tracing
FailedRequestsTracingModule | Yes* | ASP.NET Core Logging fundamentals/logging.md#the-eventsource-provider
File Caching
FileCacheModule | No | Response Caching Middleware
performance/caching/middleware
HTTP Caching
HttpCacheModule | No* | Response Caching Middleware
performance/caching/middleware
HTTP Logging
HttpLoggingModule | Yes* | ASP.NET Core Logging
Implementations: elmah.io, Loggr, NLog, Serilog
fundamentals/logging
HTTP Redirection
HttpRedirectionModule | Yes* | URL Rewriting Middleware
fundamentals/url-rewriting
IIS Client Certificate Mapping Authentication
IISCertificateMappingAuthenticationModule | Yes* |
IP and Domain Restrictions
IpRestrictionModule | Yes* |
ISAPI Filters
IsapiFilterModule | Yes | Middleware
fundamentals/middleware
ISAPI
IsapiModule | Yes | Middleware
fundamentals/middleware
Protocol Support
ProtocolSupportModule | Yes* |
Request Filtering
RequestFilteringModule | Yes* | URL Rewriting Middleware IRule
fundamentals/url-rewriting#irule-based-rule
Request Monitor
RequestMonitorModule | Yes* |
URL Rewriting
RewriteModule | Yes* (2) | URL Rewriting Middleware
fundamentals/url-rewriting
Server Side Includes
ServerSideIncludeModule | No* |
Static Compression
StaticCompressionModule | No* | Response Compression Middleware
fundamentals/response-compression
Static Content
StaticFileModule | No* | Static File Middleware
fundamentals/static-files
Token Caching
TokenCacheModule | Yes |
Custom Tracing
TracingModule | | https://github.com/aspnet/IISIntegration/issues/314
URI Caching
UriCacheModule | Yes |
URL Authorization
UrlAuthorizationModule | Yes* | ASP.NET Core Identity
security/authentication/identity
Windows Authentication
WindowsAuthenticationModule | Yes |

*Tested by @guardrex

Notes

  1. I have too many hoops to jump through to test this myself.
  2. The URL Rewrite Module's isFile and isDirectory do not work with ASP.NET Core applications due to the difference in directory structure.

Managed Modules

Module | Works | ASP.NET Core Option
--- | :---: | ---
AnonymousIdentification | No |
DefaultAuthentication | No |
FileAuthorization | No |
FormsAuthentication | No | Cookie Authentication Middleware
security/authentication/cookie
OutputCache | No | Response Caching Middleware
performance/caching/middleware
Profile | No |
RoleManager | No |
ScriptModule-4.0 | No |
Session | No | Session Middleware
fundamentals/app-state#installing-and-configuring-session
UrlAuthorization | No |
UrlMappingsModule | No | URL Rewriting Middleware
fundamentals/url-rewriting
UrlRoutingModule-4.0 | No | ASP.NET Core Identity
security/authentication/identity
WindowsAuthentication | No |

Additional Resources

Notes

  • Changes in IIS Manager to site result in changes to site's deployed web.config. Redeployment of web.config with the app will revert the changes made in IIS Manager.
  • Module features can often be disabled ...
<configuration>
   <system.webServer>
      <httpRedirect enabled="false" />
   </system.webServer>
</configuration>

or modules enabled at the server level can be disabled:

<configuration> 
  <system.webServer> 
    <modules> 
      <remove name="{Module Name}" /> 
    </modules> 
  </system.webServer> 
</configuration>
  • Ordering of modules doesn't seem important. In my local IIS, the RewriteModule is listed after the AspNetCoreModule in the ordered modules list, but rewriting an image URL in IIS worked (more info needed).

@danroth27 @Rick-Anderson I'll work through collecting data for this. I'll take relevant notes as I go in case there is more to say than "Yes" for any given module.

@Tratcher @pan-wang @shirhatti

I filled in the table with some local testing results (marked *). I could use some feedback to help ...

  1. Correct errors
  2. Add information
  3. Shape the direction of the doc

As it stands, my crude outline is ...

  • Introductory paragraph

    • Some modules work, some don't

    • Notes (shown under the table ... and I need help understanding the last one on the ordering of modules)

    • Middleware offers some direct replacement options (referring to the 3rd table column)

  • The table is an effective way to present this information, so I'll try a draft with tables similar to what you see above.
  • Additional Resources

I also have an interest in whatever the minimal module/handler config is for IIS/ANCM and (crudely) determining the perf boost associated with the minimal module/handler config. However, I doubt you will want that in this doc. http://madskristensen.net/post/remove-default-http-modules-in-aspnet

FormsAuthentication is replaced by the CookieAuthentication middleware

/cc @jhkimnew

Some pieces of RewriteModule do not work with Core, (e.g. IsFile or IsDirectory), due to changes in the file structure layout.

Hi!

I try to use IISClientCertificateMappingAuthentication without any success.
The IIS identifies my client certificate, but I'm not able to obtain the User object from my AspNetCore Web API application.
Can you provide me some example how to use that module? Or I'm only able to get the client certificate?
I'm trying to use it in AspNetCore Web API 2.1

Thanks!

Hello @carathorys ... This issue is closed. Could you open a new issue for that on this repo? Use the Content Feedback button at the bottom of the live topic: https://docs.microsoft.com/aspnet/core/host-and-deploy/iis/modules

Was this page helpful?
0 / 5 - 0 ratings