Alethic.Node.AspNet 1.0.1-pre.25

This is a prerelease version of Alethic.Node.AspNet.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Alethic.Node.AspNet --version 1.0.1-pre.25
                    
NuGet\Install-Package Alethic.Node.AspNet -Version 1.0.1-pre.25
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Alethic.Node.AspNet" Version="1.0.1-pre.25" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Alethic.Node.AspNet" Version="1.0.1-pre.25" />
                    
Directory.Packages.props
<PackageReference Include="Alethic.Node.AspNet" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Alethic.Node.AspNet --version 1.0.1-pre.25
                    
#r "nuget: Alethic.Node.AspNet, 1.0.1-pre.25"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Alethic.Node.AspNet@1.0.1-pre.25
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Alethic.Node.AspNet&version=1.0.1-pre.25&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Alethic.Node.AspNet&version=1.0.1-pre.25&prerelease
                    
Install as a Cake Tool

Alethic.Node.AspNet

Node.js in an ASP.NET (System.Web) application on .NET Framework, over Alethic.Node's pool: a pool that needs no container, work done for a request from the engine's thread, JavaScript that fetches from the site it runs in, and an application's pages served from System.Web routes. For components on Web Forms pages, see Alethic.Node.AspNet.Components.

dotnet add package Alethic.Node.AspNet
dotnet add package Microsoft.JavaScript.LibNode.win-x64

The pool

AspNetNode.Pool works with no setup: one engine. To change it, the alethic.node section in web.config:

<configSections>
  <section name="alethic.node" type="Alethic.Node.AspNet.NodeSection, Alethic.Node.AspNet" />
</configSections>

<alethic.node engineCount="2" maxConcurrencyPerEngine="4" acquireTimeout="00:00:10" />

A site with a container supplies its own pool, with every option, through HttpRuntime.WebObjectActivator.

Work for a request

var request = new NodeRequest(Context);
var html = await request.RunAsync(module, async exports =>
    (string)await ((JSPromise)request.Call(exports["render"], exports, props)).AsTask());

The work runs on an engine's thread. What it needs done as the request, with HttpContext.Current in place, it hands back with request.InvokeAsync(...), and the request's thread does it. RunAsync is for an Async="true" page; Run blocks, for one that is not.

JavaScript called through request.Call can fetch the site, and the request answers it in process as the visitor, through the site's own handler for the path: GET and HEAD, cookies, a text response.

Pages from a fetch handler

protected void Application_Start(object sender, EventArgs e)
{
    var app = new FetchRequestHandler(NodeModuleSource.FromFile(HostingEnvironment.MapPath("~/App_Data/app/app.cjs")));
    RouteTable.Routes.MapNode("about", app);
    RouteTable.Routes.MapNode("parks/{parkRef}", app);
}

The application is a CommonJS bundle whose default export has a fetch(request, env, ctx) function; Alethic.Node.Http says what it sees, and the same bundle serves from ASP.NET Core. Its response is the site's, status included. Requests no route matches go on to the site's pages; a catch-all route needs RouteTable.Routes.Ignore("{resource}.axd/{*pathInfo}") ahead of it.

One Node per process

ASP.NET restarts an application in a new AppDomain of the same process, where Node cannot start again. Keep the site from restarting in place (<httpRuntime fcnMode="Disabled" />) and recycle the application pool to deploy.

Product Compatible and additional computed target framework versions.
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Alethic.Node.AspNet:

Package Downloads
Alethic.Node.AspNet.Components

JavaScript components hosted on ASP.NET Web Forms pages: a Component control whose props are set in markup and code and kept in view state, whose callbacks raise server commands, and which renders on the server on Node embedded in the worker process, through two functions the site's own client provides.

Alethic.AspNet.Optimization.Rollup

System.Web.Optimization bundles built by Rollup, Sass, SWC, Terser and Lightning CSS, running in the site's own Node engines through Alethic.Node.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1-pre.27 61 10/4/2026
1.0.1-pre.25 62 10/4/2026
1.0.0 118 10/3/2026
1.0.0-pre.37 74 10/3/2026
1.0.0-pre.34 65 10/3/2026
1.0.0-pre.14 60 10/3/2026