Cogito.HostedWebCore
2.0.0
dotnet add package Cogito.HostedWebCore --version 2.0.0
NuGet\Install-Package Cogito.HostedWebCore -Version 2.0.0
<PackageReference Include="Cogito.HostedWebCore" Version="2.0.0" />
<PackageVersion Include="Cogito.HostedWebCore" Version="2.0.0" />
<PackageReference Include="Cogito.HostedWebCore" />
paket add Cogito.HostedWebCore --version 2.0.0
#r "nuget: Cogito.HostedWebCore, 2.0.0"
#:package Cogito.HostedWebCore@2.0.0
#addin nuget:?package=Cogito.HostedWebCore&version=2.0.0
#tool nuget:?package=Cogito.HostedWebCore&version=2.0.0
Cogito.HostedWebCore
Run the IIS request pipeline inside your own process with the IIS Hostable Web Core.
Why
The Hostable Web Core (hwebcore.dll) runs the whole IIS pipeline: static files, ASP.NET Web Forms
and MVC, and native IIS modules. It runs in any process, with no site or application pool registered
in IIS. Starting it means writing an applicationHost.config and a root Web.config to disk and
calling into a native DLL. This package builds both files from templates you ship, starts and stops
the core, and deletes the files when it shuts down.
Requirements
- Windows with the IIS Hostable Web Core feature (
IIS-HostableWebCore) enabled. - A process with the same bitness as
hwebcore.dll(64-bit on 64-bit Windows). - One hosted web core per process.
Install
dotnet add package Cogito.HostedWebCore
Use
Ship template ApplicationHost.config and Web.config files with your application, then adjust
them at startup:
await new AppHostBuilder()
.UseLogger(logger)
.ConfigureWeb("Web.config", c => c
.SystemWeb(w => w
.Compilation(z => z.TempDirectory(@"D:\Temp\ASP.NET"))))
.ConfigureApp("ApplicationHost.config", c => c
.Site(1, s => s
.RemoveBindings()
.AddHttpBinding("localhost", 8080)
.Application("/", a => a
.VirtualDirectory("/", v => v.UsePhysicalPath("wwwroot")))))
.OnStarted(h => logger.LogInformation("Started"))
.Build()
.RunAsync(cancellationToken);
RunAsync starts the core and runs until the token is cancelled. Start and Stop are there for
hosts that manage the lifetime themselves.
The generated files go to %TEMP%\<pid>.Web.config and %TEMP%\<pid>.ApplicationHost.config
unless you name other paths with SetWebConfigPath and SetAppConfigPath.
ConfigureWeb and ConfigureApp take a path, a Stream, an XDocument or an XElement. Called
with only a callback, they start from the machine's own files. For ConfigureWeb that is .NET
Framework 4's root Web.config, which ASP.NET uses whatever runtime the host is on. For
ConfigureApp it is IIS's applicationHost.config, which needs administrator rights to read.
The configuration builders come from Cogito.IIS.Configuration and Cogito.Web.Configuration.
Changes while running
Edits to a site's files are picked up as they are under IIS. Static files are served fresh, an
edited page is recompiled, and a change to an application's web.config restarts that application.
Sites and bindings are read when the host starts, so changing them needs a new host. A host can
Stop and Start again in the same process for static content. ASP.NET can't: once it has served a
request, it fails every later request in that process with a 500. A host serving ASP.NET should
restart the process instead.
License
MIT.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Framework | net47 is compatible. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
.NETFramework 4.7
- Cogito.IIS.Configuration (>= 2.0.0)
- Cogito.Web.Configuration (>= 2.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 11.0.0)
- System.ValueTuple (>= 4.6.2)
- System.Xml.XDocument (>= 4.3.0)
- System.Xml.XPath.XDocument (>= 4.3.0)
-
net10.0
- Cogito.IIS.Configuration (>= 2.0.0)
- Cogito.Web.Configuration (>= 2.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 11.0.0)
- System.ValueTuple (>= 4.6.2)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Cogito.HostedWebCore:
| Package | Downloads |
|---|---|
|
Cogito.HostedWebCore.ServiceFabric
Service Fabric support for IIS Hosted Web Core. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.0 | 63 | 12/1/2026 |
| 1.3.3-pre.23 | 46 | 12/1/2026 |
| 1.3.2 | 1,674 | 2/8/2020 |
| 1.3.1 | 1,112 | 9/12/2019 |
| 1.2.12 | 843 | 9/11/2019 |
| 1.2.11 | 880 | 9/7/2019 |
| 1.2.9 | 938 | 7/20/2019 |
| 1.2.8 | 879 | 7/20/2019 |
| 1.2.6 | 923 | 6/17/2019 |
| 1.2.5 | 891 | 6/16/2019 |
| 1.2.1 | 5,298 | 3/30/2019 |
| 1.2.0 | 1,008 | 2/12/2019 |
| 1.1.1 | 1,027 | 1/26/2019 |
| 1.1.0-unstable0019 | 994 | 9/27/2018 |
| 1.1.0-unstable0017 | 939 | 9/26/2018 |
| 1.1.0-unstable0016 | 947 | 9/26/2018 |
| 1.1.0-unstable0014 | 1,418 | 7/13/2018 |
| 1.1.0-unstable0012 | 1,465 | 4/2/2018 |
| 1.1.0-alpha0022 | 826 | 1/25/2019 |
| 1.1.0-alpha0020 | 810 | 1/14/2019 |