Commit Graph

21 Commits

Author SHA1 Message Date
Arthur Vickers b5adc6b156 Move Database Error Page tests to SQLite
In an attempt to make them more reliable.

See also https://github.com/aspnet/EntityFrameworkCore/issues/15997
2019-06-07 16:31:29 -07:00
Nate McMaster ae8e96f154
Remove API check baselines and related project settings (#9846) 2019-04-30 14:58:13 -07:00
Ryan Nowak 658b37d2bd
Make UseEndpoints a thing (#8765)
* Make endpoint middleware explicit

This change makes the endpoint middleware explicit again, and updates
all of the templates.

The other change here is make UseEndpoints be the place where you
register endpoints. This is vital because it puts your code visually at
the point of the pipeline where it executes.

Lastly, I removed support for UseMvc with endpoint routing. This is
causing issues for some security features, and we're moving in the
direction of trying to make the middleware heavy implementation required
in 3.0. There are some issues we won't be able to fix in MVC if we can't
unambiguously know if UseMvc was used or the middleware.
2019-03-28 15:41:11 -07:00
Ryan Nowak 30d0afca05 Remove DisplayName overload from health checks
The builder now provides this directly.
2019-03-13 20:12:53 -07:00
Ryan Nowak e78a6521b9 Make naming of IEndpointRouteBuilderConsistent across usages. 2019-03-13 20:12:53 -07:00
James Newton-King 21b20afb1d
Add friendly error message for when healthchecks services not registered (#8146) 2019-03-12 11:32:58 -07:00
Chris Baudin 77948feeba Update reference assemblies for health checks. 2019-03-11 20:56:08 -07:00
Chris Baudin 484978fe59 Update the health check endpoint route builder extensions to make the endpoint display name configurable. (#8359) 2019-03-11 20:56:08 -07:00
Pavel Krymets 9355c7c1a5
Add reference assemblies support (#7764) 2019-02-21 14:33:35 -08:00
Chris Ross 4e44025a52
Replace IHostingEnvironment with IWebHostEnvironment (#7725) 2019-02-19 21:11:52 -08:00
Nate McMaster 3fd8a97af2
Add targets to generate the list of shared framework assemblies from project property (#7510)
Changes:
* Add support for a property, `IsAspNetCoreApp`, in the .csproj file of assemblies which are part of the shared framework. 
* Remove unused dependencies
* Remove reference which have become part of 'netcoreapp3.0'
2019-02-12 23:00:19 -08:00
Travis Illig f072523780 Minor argument check fixes
Fixed `nameof()` reference to be consistent with arg being checked. Added null check for port to be consistent with earlier overload.
2019-01-14 15:00:20 -08:00
Nate McMaster 0f65d44482
Merge branch 'release/2.2' 2019-01-09 18:09:25 -08:00
Nate McMaster a3f9b74bb9
Merge branch 'release/2.1' into release/2.2 2019-01-09 14:52:53 -08:00
James Newton-King 5ab3c89be3
Add health checks routing extensions (#5127) 2018-12-21 11:18:44 +13:00
Cédric Luthi 4a9a96cef7 Make the ResultStatusCodes property null-resettable 2018-12-13 14:09:21 -08:00
Cédric Luthi 74d900ea56 Add setter to HealthCheckOptions.ResultStatusCodes
All other properties (`Predicate`, `ResponseWriter` and `AllowCachingResponses`) have a setter but `ResultStatusCodes` doesn't.

Without a setter, reusing the same status to http status code mapping is impossible and leads to duplicate code that looks like this:

```csharp
private static void ConfigureHealthChecks(IApplicationBuilder app, HealthCheckServiceOptions options)
{
    app.UseHealthChecks("/health", new HealthCheckOptions
    {
        ResultStatusCodes =
        {
            [HealthStatus.Healthy] = StatusCodes.Status200OK,
            [HealthStatus.Degraded] = StatusCodes.Status400BadRequest,
            [HealthStatus.Unhealthy] = StatusCodes.Status503ServiceUnavailable
        }
    });
    foreach (var name in options.Registrations.Select(e => e.Name))
    {
        app.UseHealthChecks($"/health/{name}", new HealthCheckOptions
        {
            Predicate = registration => registration.Name == name,
            ResultStatusCodes =
            {
                [HealthStatus.Healthy] = StatusCodes.Status200OK,
                [HealthStatus.Degraded] = StatusCodes.Status400BadRequest,
                [HealthStatus.Unhealthy] = StatusCodes.Status503ServiceUnavailable
            }
        });
    }
}
```

With a setter, this code could be rewritten in a *don't repeat yourself* (DRY) way:

```csharp
private static void ConfigureHealthChecks(IApplicationBuilder app, HealthCheckServiceOptions options)
{
    var resultStatusCodes = new Dictionary<HealthStatus, int>
    {
        [HealthStatus.Healthy] = StatusCodes.Status200OK,
        [HealthStatus.Degraded] = StatusCodes.Status400BadRequest,
        [HealthStatus.Unhealthy] = StatusCodes.Status503ServiceUnavailable
    };
    app.UseHealthChecks("/health", new HealthCheckOptions
    {
        ResultStatusCodes = resultStatusCodes
    });
    foreach (var name in options.Registrations.Select(e => e.Name))
    {
        app.UseHealthChecks($"/health/{name}", new HealthCheckOptions
        {
            Predicate = registration => registration.Name == name,
            ResultStatusCodes = resultStatusCodes
        });
    }
}
```
2018-12-13 14:09:21 -08:00
Nate McMaster c8da5ed085
Remove conditional target frameworks on HealthChecks sample (#4235) 2018-11-26 11:50:19 -08:00
Nate McMaster f67acd67a2
Update test projects to netcoreapp3.0 2018-11-21 16:50:09 -08:00
Nate McMaster cb198d727b
Reorganize source code in preparation to move into aspnet/AspNetCore
Prior to reorganization, this source code was found in 082d505977
2018-11-21 16:21:23 -08:00
Nate McMaster 16212ae6df
Reorganize source code in preparation to move into aspnet/AspNetCore
Prior to reorganization, this source code was found in c802d5ef5f
2018-11-21 15:22:25 -08:00