Bring an existing ASP.NET application
An Isoplane application keeps its Program.cs. Isoplane supplies the server
transport; your application does not open a listener.
Keep an ordinary .NET project for code that also runs elsewhere, and reference it from the Isoplane application project. Libraries still need to support the sandbox's capabilities.
Create the application project
Follow the Quickstart's creation step to make a MyApi
project next to your existing code. This supplies the matching SDK and launch
settings. Move your startup code into its Program.cs. If your application logic
is already in a separate library, add an ordinary project reference to that
library instead of copying its code.
Keep the existing project available while porting. Build and run a small route first, then add the remaining services and routes and their integration tests.
Adapt Program.cs
Two lines differ from an ordinary ASP.NET application:
using Isoplane.AspNetCore;
var builder = IsoplaneHosting.CreateBuilder(args);
// Register application services here.
var app = builder.Build();
app.MapGet("/", () => "Hello from MyApi");
await app.RunAsync();
IsoplaneHosting.CreateBuilder(args)replacesWebApplication.CreateBuilder(args).- The file ends with
await app.RunAsync(). The synchronousapp.Run()blocks until shutdown, which a sandboxed application cannot do. The editor marks the call as the errorISOPLANE1020and offers a quick fix that replaces it withawait app.RunAsync(), making an explicitvoid Mainasynchronous when there is one. ARunAsyncwhose task is discarded or blocked on isISOPLANE1021, with the same fix.
Everything between stays as it was: service registrations before
builder.Build(), middleware and endpoints after it.
Isoplane runs Program.cs up to RunAsync during template preparation.
Preparation may retry; reusing a prepared template runs no initialization.
Every instance starts from the captured result. Settings, including
connection strings, are available while it runs. Two things do not carry over
into an instance: an open connection, so close any that start-up opens, and
uniqueness, so create a value that must differ between instances when an instance
starts. See the application lifecycle.
Configuration
IsoplaneHosting.CreateBuilder reads appsettings.json, then
appsettings.{Environment}.json, then the settings the platform supplies. It does
not read your machine's environment variables. See
local development settings for how to supply settings and
choose the environment while developing.
Check application assumptions
Go through this list once for an existing application. Each item says what to
look for, how to find it, and what to do about it. An AI coding agent can work
through it too, once isoplane skills install has given it a skill that links
to these pages. Work with an AI coding agent
describes that command.
- Blocking calls. A synchronous wait such as
.Result,.Wait(),Thread.Sleepor a synchronous database call throws in the sandbox. Build with the analyzer's dependency inspection on and fix eachISOPLANE1003. Find and fix blocking calls walks through it. - Threads. Starting a thread throws, and the analyzer reports it as
ISOPLANE1002. Rewrite the work as async code that the request awaits. See one thread per instance. - Long computations. A method that computes for a long time without awaiting stalls its instance and can't be cancelled. Split it up as running time describes.
- Continuous and scheduled work. A
BackgroundServiceloop, a queue consumer or a job scheduler runs only while its instance exists and stops silently when the instance goes. Search forBackgroundService,IHostedServiceand scheduling packages. Drive the work from an endpoint instead, as Run work on a schedule shows. See background work. - WebSockets and HTTP/2. Requests arrive as HTTP/1.1 without trailers, which rules out gRPC over HTTP/2. WebSockets are currently unavailable. SignalR and Blazor Server interactivity need sticky sessions, which Isoplane does not keep, so they are currently unsupported. gRPC-Web, server-sent events and statically rendered Blazor pages work. See incoming requests and SignalR and Blazor Server.
- Data Protection keys. Antiforgery tokens, the TempData cookie and
authentication cookies need the key that protected them. By default a fresh
preparation may generate a different key. The SDK can derive keys from
settings during preparation or reload them from an external store at each
instance start. Keep earlier unrevoked keys while their data must remain readable.
Keep the keys across builds. The
isoplane-webapptemplate is set up this way. - MCP servers. A server built with
ModelContextProtocol.AspNetCoreworks over Streamable HTTP in its stateless mode. With session tracking on, the application starts, but a request that reaches an instance other than the one holding its session fails with 404Session not found. Theisoplane-mcpservertemplate is such a server. - Durable state. Static fields,
IMemoryCacheand in-memory session state belong to one instance and can vanish at any time. Keep anything that must last in a database or another external service. See instance state. - Database connections. Every instance pools connections on its own, so a pool size in the application caps nothing overall, and the pool goes when its instance does. Cap connections with your provider's pooler, such as PgBouncer or a pooled endpoint, and open a connection per request. Connect to PostgreSQL shows this, with the driver's own pooling off.
- Files. The file system is read-only. Files in
wwwrootare part of the application package, so serve them withapp.MapStaticAssets()orapp.UseStaticFiles(). For uploads and files the application generates, see Handle uploads and generated files. - Native libraries. A NuGet package that ships a native binary fails on
the code path that calls it. Switch on
IsoplaneAnalyzeDependenciesandIsoplaneWarnOnNativeImportsto have the build list such declarations in packages, as Control compatibility warnings shows. See native libraries. - Framework assemblies. A package that depends on an older version of an assembly ASP.NET Core provides gets the framework's copy, as in an ordinary ASP.NET Core project. Nothing to do.
How .NET differs on Isoplane covers everything else that differs from a server process, and library compatibility lists the packages and framework features known not to work, with what to use in their place.