Table of Contents

Getting Started

To use the Health Checks in your project you can add both libraries [Microsoft.Extensions.Diagnostics.HealthChecks] and [WebPx.Web.HealthUI.Razor] to your project.

  1. Add required Nuget packages
  • You can add the required nuget packages to your project file
  <ItemGroup>
    <PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="8.0.12" />
    <PackageReference Include="WebPx.Web.HealthUI.Razor" Version="1.0.0" />
  </ItemGroup>
  • Or Install the packages in the Package Manager:
install-package Microsoft.Extensions.Diagnostics.HealthChecks
install-package WebPx.Web.HealthUI.Razor
  • Or Install the packages in the command prompt
dotnet add package Microsoft.Extensions.Diagnostics.HealthChecks --version 8.0.12
dotnet add package WebPx.Web.HealthUI.Razor --version 1.0.0
  1. Add the depenencies from CDNJS to your libman.json file or create a new libman.json file with the following content
{
  "version": "3.0",
  "defaultProvider": "cdnjs",
  "libraries": [
    {
      "provider": "cdnjs",
      "library": "bootstrap@5.3.3",
      "destination": "wwwroot/lib/bootstrap/",
      "files": [
        "js/bootstrap.bundle.min.js",
        "js/bootstrap.bundle.min.js.map",
        "css/bootstrap.min.css",
        "css/bootstrap.min.css.map"
      ]
    },
    {
      "provider": "cdnjs",
      "library": "bootstrap-icons@1.11.3",
      "destination": "wwwroot/lib/bootstrap-icons/",
      "files": [
        "font/fonts/bootstrap-icons.woff2",
        "font/fonts/bootstrap-icons.woff",
        "font/bootstrap-icons.min.css"
      ]
    }
  ]
}
  1. To customize where the files the template should find them, add the following code to your Program.cs file. Remember just to change the paths if you have a different folder structure, do not include the .css or .js filename
    builder.Services.AddHealthUI(c =>
    {
        c.BaseUri = "/";
        c.BootstrapPath = "/lib/bootstrap";
        c.BootstrapIconPath = "/lib/bootstrap-icons";
    });
  1. You can also set this settings in your appsettings.json file
{
  "WebPx": {
    "Health": {
      "UI": {
        "BaseUri": "/",
        "BootstrapPath": "/lib/bootstrap",
        "BootstrapIconPath": "/lib/bootstrap-icons"
      }
    }
  }
}