# HealthCheck

Namespace: **Wisej.Core**

Assembly: **Wisej.Framework** (4.0.0.0)

Handler for healthcheck requests sent by load balancers.

{% tabs %}
{% tab title="C#" %}

```csharp
public class HealthCheck
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class HealthCheck
```

{% endtab %}
{% endtabs %}

Configure the load balancer to use "<http://your-server/healthcheck.wx>" as the health check URL.\
You can modify the default healthcheck value either by placing a Healthcheck.json file in the root of your project, or programmatically assigning the values to Wisej.Core.HealthCheck properties. See [load-balancing](https://docs.wisej.com/deployment/concepts/load-balancing).

```csharp


static class Program {

  // static constructor.
  static Program() {

    Wisej.Core.HealthCheck.MaxCPU = 0; // ignore
    Wisej.Core.HealthCheck.MaxMemory = 85;
    
  }
}

```

## Fields

| Name                  | Type                                                                  | Description                                                                                                                                          |
| --------------------- | --------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| **IsServerAvailable** | [Func\<Boolean>](https://docs.microsoft.com/dotnet/api/system.func-1) | Custom function placeholder assignable by the application to determine when a server should return that it's not available to receive more sessions. |

## Properties

### ![](/files/lIX317sDtMTZJBi9oSIx) Enabled

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether the load balancing features are enabled.

### ![](/files/lIX317sDtMTZJBi9oSIx) MaxCPU

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Maximum CPU load in percentage: Default: 100; 0 = unlimited.

### ![](/files/lIX317sDtMTZJBi9oSIx) MaxMemory

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Maximum percentage of allocated memory. Default: 70; 0 = unlimited.

### ![](/files/lIX317sDtMTZJBi9oSIx) MaxSessions

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Maximum number of active sessions: Default: 0; 0 = unlimited.

### ![](/files/lIX317sDtMTZJBi9oSIx) ResponseHeader

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the response header to return to the browser.

Can be used in conjunction with the [ReturnCode](#returncode) set to 200 (OK) and the value of the return header set to "Refresh: 0; Set-Cookie: AffinityCookie=" to cause the client browser to load the affinity cookie and reload the page to (hopefully) reach another server.

### ![](/files/lIX317sDtMTZJBi9oSIx) RetryAfter

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Value for the Retry-After header in minutes. Default: 10.

### ![](/files/lIX317sDtMTZJBi9oSIx) ReturnCode

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Http return code to signal that this server is not available. Default: 503.

### ![](/files/lIX317sDtMTZJBi9oSIx) ReturnUrl

[String](https://docs.microsoft.com/dotnet/api/system.string): Redirection Url in alternative to the error return code. Default: null.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wisej.com/api/wisej.core/general/wisej.core.healthcheck.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
