Show / Hide Table of Contents

Client Overview

App Settings

You can add Rest Client configurations in wwwroot/appsettings.json by adding a RestClient section

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Information"
    }
  },
  "RestClient": {
    "BaseAddress": "https://localhost:7074"
  },
  "AllowedHosts": "*"
}

Startup

Program.cs (leverages appsettings.json)

builder.Services.AddRestClient();

Program.cs (inline configuration)

builder.Services.AddRestClient((httpClient) => {
    httpClient.BaseAddress = new Uri(builder.HostEnvironment.BaseAddress);
});
  • Improve this Doc
In This Article
Back to top Generated by DocFX