• Stars
    star
    138
  • Rank 264,428 (Top 6 %)
  • Language
    C#
  • Created over 4 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A prototype running ASP.NET and ASP.NET Core in the same IIS pipeline

Running ASP.NET and ASP.NET Core in the same IIS pipeline

This is an experiment showing how to run ASP.NET WebAPI and ASP.NET Core in the IIS pipeline (it can be in process or out of process). The idea is to experiment with ways to use any custom logic to determine which routes go to ASP.NET Core and which ones go to ASP.NET. This can aid in porting large applications to ASP.NET Core in a route by route manner.

Instructions

  1. Make sure IIS is running in 64 bit mode for ASP.NET.

    image

  2. Mark Greenfield as the startup project and run the app for first time initialization with IIS Express.

  3. Stop the app.

  4. Mark LegacyApi as the startup project and run the application.

  5. Navigating to /api/weather/* will take you to the ASP.NET Core application, and all other URLs go to the ASP.NET application.

How it works

  1. The ASP.NET Core module is a regular IIS module. It can be installed into an IIS based project:

    <system.webServer>
        <handlers>
            <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
            <remove name="OPTIONSVerbHandler" />
            <remove name="TRACEVerbHandler" />
            <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" modules="AspNetCoreModuleV2" preCondition="integratedMode,runtimeVersionv4.0" />
        </handlers>
        <aspNetCore processPath="dotnet" arguments="bin\Greenfield\Greenfield.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="outofprocess" />
    </system.webServer>

    We've installed the ASP.NET Core module into the ASP.NET MVC project that pointed it to our Greenfield application. Notice we've done this after the ExtensionlessUrlHandler module, this is important because we're going to use the ASP.NET MVC project to determine which routes should go to ASP.NET Core.

  2. In Global.asax.cs we're using Application_PostResolveRequestCache which runs after the routing module and we use the URL to determine if we want to route to ASP.NET Core via Context.RemapHandler.

  3. Setting the handler to null allows the next module to run in the pipeline and it will execute the ASP.NET Core module.

NOTE: The hostingModel attribute can be either inprocess or outofprocess. Either works. See below for the list of limiations for each mode.

Diagram

Limitations

  • When using inprocess mode:
    • It is likely that .NET Framework and .NET Core will run OK together (though this isn't officially supported).
    • Some diagnostics are also likely hosed (dumps, debugging, etw etc.)
    • It isn't possible to run multiple applications in same app pool (in process mode).
    • Communcation between runtimes works if you use COM or any other interop technologies.
    • Native dlls that have the same name can conflict within the same process.
    • There are 2 separate CLRs in the process that don't know about each other running ServerGC.

Benefits

  • Managed and Native IIS modules run for both ASP.NET and ASP.NET Core applications
  • Deployment process can pretty much stay the same (as long as you add the ASP.NET Core application as a payload within the ASP.NET application)
  • Allows routing to ASP.NET Core based on arbitrary application logic.

More Repositories

1

AspNetCoreDiagnosticScenarios

This repository has examples of broken patterns in ASP.NET Core applications
C#
7,686
star
2

TodoApi

Todo application with ASP.NET Core Blazor WASM, Minimal APIs and Authentication
C#
2,718
star
3

DotNetCodingPatterns

A collection of coding patterns in no particular order
1,357
star
4

Todos

Various todo list backend API implementations
C#
1,040
star
5

BedrockFramework

High performance, low level networking APIs for building custom servers and clients.
C#
1,038
star
6

Micronetes

Micronetes is a local orchestrator inspired by kubernetes that makes developing and testing microservices and distributed applications easier.
C#
773
star
7

TcpEcho

Basic TCP server that uses System.IO.Pipelines to parse line based messages
C#
352
star
8

Channels

Push based .NET Streams
C#
292
star
9

MultiProtocolAspNetCore

C#
251
star
10

TriviaR

A multiplayer trivia game using SignalR and .NET 7
C#
196
star
11

Roslyn.Reflection

Reflection APIs over roslyn symbol APIs
C#
185
star
12

YarpTunnelDemo

YARP demo showing how tunneling can be implemented over websockets
C#
161
star
13

QueryInterceptor

Provides a generic way to intercept IQueryable expression trees using custom expression visitors.
C#
159
star
14

uController

A source generator for minimal APIs
C#
159
star
15

CommandAndControl

A sample showing command and control using client results
HTML
158
star
16

IdentityEndpointsSample

A sample showing how to setup ASP.NET Core Identity API endpoints for authentication
C#
155
star
17

Pubbie

A high performance pubsub client/server implementation for .NET Core
C#
132
star
18

NetStandard

A repository that describes the .NET Standard
C#
128
star
19

WebApplicationPlugins

A sample plugin model for ASP.NET Core applications
C#
119
star
20

eStoreLite

Simple eStore frontend backend application using ASP.NET Core
C#
106
star
21

WinDbgCheatSheet

This is a cheat sheet for windbg
104
star
22

BombRMan

A multiplayer bomberman clone written in JavaScript and C#
TypeScript
97
star
23

DotnetPerformanceTips

93
star
24

signalr-ports

JavaScript
92
star
25

NuGetPowerTools

A bunch of powershell modules that make it even easier to work with nuget
84
star
26

DynamicLinq

Dynamic LINQ queries based on C# 4 dynamic.
C#
83
star
27

WaitForDependenciesAspire

C#
81
star
28

HelloWorldVNext

Hello world applications on ASP.NET vNext
C#
79
star
29

SmartLoadBalancer

Sticky sessions without sticky sessions
C#
74
star
30

Scheduling

Experimenting with schedulers
C#
70
star
31

Jabbot

Bot API for JabbR
C#
66
star
32

AspireYarp

Yarp resource for Aspire.Hosting
C#
64
star
33

CacheR

A distributed cache implemented on top of SignalR
C#
63
star
34

UT3

C#
58
star
35

CommunityStandUpNet5

A set of samples show casing the .NET linker and .NET 5 APIs
C#
57
star
36

AspNetCoreRecipes

Recipes for common ASP.NET Core patterns
50
star
37

OwinHttpClient

Barebones http client that uses the owin interface built on .NET socket API.
C#
48
star
38

AspNetCoreOwinSample

A sample showing running OWIN based frameworks on top of ASP.NET Core
C#
47
star
39

MessengR

One on one messenger app using SignalR
JavaScript
45
star
40

EventGridDemo

C#
45
star
41

Streamer

JSON RPC over any bidirectional stream
C#
43
star
42

TcpProxy

A sample showing how to implement a tcp proxy using new kestrel APIs
C#
43
star
43

Build2024AspireDemo

HTML
43
star
44

AspireSwaggerUI

An aspire resource for showing swagger ui
C#
42
star
45

RestSample

C#
42
star
46

ServerStack

C#
36
star
47

Orleans.PubSub

A pub sub implementation built on top of orleans grains
C#
36
star
48

gRPCSamples

C#
34
star
49

AspirePulumi

A demo showing pulumi and aspire
C#
34
star
50

HotReload

Another attempt at hotreloading
C#
33
star
51

Core3HiddenGems

Demos for the NDC Oslo 2019 Talk
32
star
52

Sockets

31
star
53

DocsStaging

30
star
54

SignalR.Lite

A lightweight version of SignalR
JavaScript
30
star
55

FasterActions

exploring faster code generation techniques that take advantage of the JIT's de-virtualization and in-lining
C#
29
star
56

StreamingSample

A sample doing bidirectional streaming with ASP.NET Core and HTTP client
C#
27
star
57

SignalR.Orleans

SignalR orleans backplane
C#
27
star
58

BlazorBlog

C#
27
star
59

NdcLondon2018

C#
25
star
60

QueueDown

C#
25
star
61

OtlpDemo

Demo of .NET an otlp
C#
24
star
62

NdcLondon2020

Demos for NDC London 2020
HTML
22
star
63

AspireWithRedis

A simple hello world aspire redis project
C#
21
star
64

AsyncIO

Helper library for doing async io in .net
C#
19
star
65

AspNetCoreCsproj

ASP.NET Core project in a classic .NET Framework Console Library
C#
17
star
66

SignalRAsyncPatterns

JavaScript
17
star
67

SourceGeneratorPlayground

A playground for source generation ideas for asp.net core
C#
17
star
68

vNextLanguageSupport

A project that has examples of how to support different languages in the vNext project system
C#
16
star
69

ServiceProviderFactorySample

C#
15
star
70

PluginSample

A sample showing plugin systems in .NET
C#
15
star
71

WebQWorker

C#
13
star
72

GenericHostPOC

WebHost POC for generic host
C#
12
star
73

HostingOptions

A sample repository showing hosting options for ASP.NET 5 projects
C#
12
star
74

NuGet.Build

Build script used by NuGet package restore.
12
star
75

DiagnosticListenerSample

A sample showing how to use DiagnosticListener to handle request events
C#
12
star
76

build2018talk

C#
11
star
77

DesignTimeHostDemo

Example of how to use the ASP.NET vNext design time host
C#
11
star
78

BasicKestrel

C#
10
star
79

PipelinesSample

C#
10
star
80

XmlSettings

A general purpose settings ini style file in xml format.
C#
10
star
81

ConfigSourceGenerator

C#
10
star
82

SignalR.Ninject

Ninject dependency resolver for SignalR
C#
10
star
83

nuget-stats

Statistics web app for the official NuGet gallery.
C#
8
star
84

ReleaseNotesMaker

Little tool to generate release notes for SignalR
C#
8
star
85

ODataNullPropagationVisitor

Fix for odata's aggressive null propagation logic
C#
8
star
86

AzureSignalRLightupPrototype

Prototype of new azure signalr startup experience with ASP.NET Core 3.0
C#
8
star
87

LinkedAspNetCoreApplication

C#
8
star
88

AspireEventHub

A sample showing event hubs and aspire
C#
8
star
89

MinimalDiagnosticsSDK

C#
7
star
90

SignalR.Fleck

JavaScript
7
star
91

ParsingTechniques

6
star
92

Oscon2016

C#
6
star
93

Tshtml

Ideas
C#
6
star
94

WorkerTemplate

C#
6
star
95

aspnet-buzz

A site written on ASP.NET 5 that displays a live feed of ASP.NET stuff
C#
6
star
96

NDCLondon2017

C#
6
star
97

SignalR.Relay

JavaScript
5
star
98

ReactivePlayground

Ideas around ASP.NET and Rx
C#
5
star
99

AuthCookieOptions

A sample showing how to configure cookie options from the DI container
C#
5
star
100

Coroutines

Messing around with async and scheduling
C#
5
star