---
title: "HttpHandlerAttribute class"
canonical: https://isoplane.dev/docs/reference/sdk/Isoplane.Sdk/Isoplane/HttpHandlerAttribute
---

# HttpHandlerAttribute class

Marks the method that handles every HTTP request in an application written without ASP.NET.

```csharp
[AttributeUsage(AttributeTargets.Method)]
public sealed class HttpHandlerAttribute : Attribute
```

## Public Members

| name                                                                                                               | description              |
| ------------------------------------------------------------------------------------------------------------------ | ------------------------ |
| [HttpHandlerAttribute](https://isoplane.dev/docs/reference/sdk/Isoplane.Sdk/Isoplane/HttpHandlerAttribute/-ctor)() | The default constructor. |

## Remarks

Use it when one method is all the application needs. The project uses the `Isoplane.Sdk` project SDK and has no `Program.cs`; `dotnet new isoplane-handler` creates one, with tests. An application that wants routing, middleware or dependency injection is an ASP.NET application instead, and starts from `IsoplaneHosting.CreateBuilder`. [Handle requests without ASP.NET](https://isoplane.dev/docs/how-to/handle-requests-without-aspnet) walks through a complete project.

The method is static, returns `Task<Response>` and takes a [`Request`](https://isoplane.dev/docs/reference/sdk/Isoplane.Sdk/Isoplane/Request). It can have any name. It may take a [`StreamingRequest`](https://isoplane.dev/docs/reference/sdk/Isoplane.Sdk/Isoplane/StreamingRequest) in place of the [`Request`](https://isoplane.dev/docs/reference/sdk/Isoplane.Sdk/Isoplane/Request), to read a large body as it arrives. An application has exactly one such method. The build reports an error on a method that breaks these rules, on a second marked method, and on a project that has none.

Isoplane scales instances with traffic, up to the application’s instance limit, and may discard an instance between requests. Await work the response depends on before returning. Remaining work transfers to the instance’s bounded background allowance and may never finish. Keep durable state in a database or another external service.

## Examples

```csharp
using Isoplane;

public static class Handler
{
    [HttpHandler]
    public static Task<Response> HandleAsync(Request request) =>
        Task.FromResult(request.Path == "/"
            ? Response.Text("Hello from Isoplane!")
            : Response.Text("Not found", 404));
}
```

## See Also

- class [TemplateInitializerAttribute](https://isoplane.dev/docs/reference/sdk/Isoplane.Sdk/Isoplane/TemplateInitializerAttribute)
- class [InstanceStartAttribute](https://isoplane.dev/docs/reference/sdk/Isoplane.Sdk/Isoplane/InstanceStartAttribute)
- namespace [Isoplane](https://isoplane.dev/docs/reference/sdk/Isoplane.Sdk)
