# 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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Enabled

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) MaxCPU

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) MaxMemory

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) MaxSessions

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) 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.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) RetryAfter

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) ReturnCode

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) ReturnUrl

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