# System.Web.Http.WebHost

**Kind:** Service

**Source:** `Pams/API/Pams.API/Pams.API.csproj` (line 1)

**Part of:** [Pams](subsystem-pams)

NuGet package dependency

`System.Web.Http.WebHost` is a NuGet package dependency in `Pams.API.csproj` that connects ASP.NET Web API to the `System.Web` hosting pipeline. It routes HTTP requests from the web host to Web API controllers and returns controller responses through the host.

## Diagram

```mermaid
sequenceDiagram
    participant Client
    participant Host as IIS / System.Web
    participant WebHost as System.Web.Http.WebHost
    participant Controller as Web API Controller

    Client->>Host: Send HTTP request
    Host->>WebHost: Route request to Web API
    WebHost->>Controller: Invoke controller action
    Controller-->>WebHost: Return HTTP response
    WebHost-->>Host: Write response
    Host-->>Client: Send HTTP response
```

## Usage

```ts
// System.Web.Http.WebHost runs on the server.
// Client code calls endpoints hosted by the ASP.NET Web API application.

async function getPamsData() {
  const response = await fetch("/api/pams");

  if (!response.ok) {
    throw new Error(`Request failed: ${response.status}`);
  }

  return response.json();
}

getPamsData().then((data) => {
  console.log(data);
});
```

## AI Coding Instructions

- Keep the `System.Web.Http.WebHost` package reference in `Pams.API.csproj` when the API is hosted through `System.Web` or IIS.
- Route Web API requests through configured controllers and HTTP routes rather than calling host pipeline types from client code.
- Treat this dependency as server-side infrastructure; JavaScript and TypeScript clients should call API endpoints over HTTP.
- Check compatibility with other `System.Web.Http` package references before changing package versions or target framework settings.

## Used by

1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

### Injected or called by (1)

- `Pams.API` — `Pams/API/Pams.API/Pams.API.csproj`:1
