This commit is contained in:
@@ -24,11 +24,12 @@
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="4.1.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="4.1.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.ApiDescription.Server" Version="3.1.0">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="3.1.4" />
|
||||
<PackageReference Include="Microsoft.OpenApi" Version="1.1.4" />
|
||||
<PackageReference Include="MiniProfiler.AspNetCore.Mvc" Version="4.1.0" />
|
||||
<PackageReference Include="MiniProfiler.EntityFrameworkCore" Version="4.1.0" />
|
||||
|
||||
@@ -49,22 +49,25 @@ namespace AyaNova
|
||||
{
|
||||
_newLog.LogDebug("Initializing services...");
|
||||
|
||||
// _newLog.LogDebug("Profiler");
|
||||
// //https://dotnetthoughts.net/using-miniprofiler-in-aspnetcore-webapi/
|
||||
// services.AddMemoryCache();
|
||||
// services.AddMiniProfiler(options =>
|
||||
// {
|
||||
// options.RouteBasePath = "/profiler";
|
||||
// //in testing only ignorepaths was reliable and worked and docs say it prevents any profiling at all
|
||||
// options.IgnorePath("/auth").IgnorePath("/user").IgnorePath("/docs");
|
||||
// options.ResultsAuthorize = request =>
|
||||
// {
|
||||
// if (request.HttpContext.Items["AY_PROFILER_ALLOWED"] != null)
|
||||
// return true;
|
||||
// return false;
|
||||
// };
|
||||
// //options.ShouldProfile = request => false;
|
||||
// }).AddEntityFramework();
|
||||
_newLog.LogDebug("Health");
|
||||
services.AddHealthChecks().AddDbContextCheck<AyContext>();;
|
||||
|
||||
_newLog.LogDebug("Profiler");
|
||||
//https://dotnetthoughts.net/using-miniprofiler-in-aspnetcore-webapi/
|
||||
services.AddMemoryCache();
|
||||
services.AddMiniProfiler(options =>
|
||||
{
|
||||
options.RouteBasePath = "/profiler";
|
||||
//in testing only ignorepaths was reliable and worked and docs say it prevents any profiling at all
|
||||
options.IgnorePath("/auth").IgnorePath("/license").IgnorePath("/user").IgnorePath("/docs");
|
||||
options.ResultsAuthorize = request =>
|
||||
{
|
||||
if (request.HttpContext.Items["AY_PROFILER_ALLOWED"] != null)
|
||||
return true;
|
||||
return false;
|
||||
};
|
||||
|
||||
}).AddEntityFramework();
|
||||
|
||||
|
||||
//Server state service for shutting people out of api
|
||||
@@ -474,13 +477,14 @@ namespace AyaNova
|
||||
|
||||
|
||||
_newLog.LogDebug("Profiler");
|
||||
// app.UseMiniProfiler();
|
||||
app.UseMiniProfiler();
|
||||
|
||||
|
||||
|
||||
_newLog.LogDebug("Endpoints pipeline");
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapHealthChecks("/health");
|
||||
endpoints.MapControllers();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user