This commit is contained in:
2020-05-30 20:10:41 +00:00
parent 217488872f
commit 7f7b5c3ac2
7 changed files with 44 additions and 76 deletions

View File

@@ -107,6 +107,12 @@ namespace AyaNova
FileUtil.EnsureUserAndUtilityFoldersExistAndAreNotIdentical(_hostingEnvironment.ContentRootPath);
#region DATABASE
// //NOTE: this is required to workaround a bug with miniprofiler
// //if I don't add the memory cache service miniprofiler does but the
// //addition of npgsql below fucks up the config for memory cache somehow
// //documented here: https://github.com/MiniProfiler/dotnet/issues/433
// services.AddMemoryCache();
_connectionString = ServerBootConfig.AYANOVA_DB_CONNECTION;
//Check DB server exists and can be connected to
@@ -283,75 +289,7 @@ namespace AyaNova
#endregion
#region Mini Profiler
// services.AddMemoryCache();
services.AddMiniProfiler(options =>
{
// All of this is optional. You can simply call .AddMiniProfiler() for all defaults
// (Optional) Path to use for profiler URLs, default is /mini-profiler-resources
// options.RouteBasePath = "/profiler";
// (Optional) Control storage
// (default is 30 minutes in MemoryCacheStorage)
// (options.Storage as System.Runtime.MemoryCacheStorage).CacheDuration = TimeSpan.FromMinutes(60);
// (Optional) Control which SQL formatter to use, InlineFormatter is the default
// options.SqlFormatter = new StackExchange.Profiling.SqlFormatters.InlineFormatter();
// (Optional) To control authorization, you can use the Func<HttpRequest, bool> options:
// (default is everyone can access profilers)
// options.ResultsAuthorize = request => MyGetUserFunction(request).CanSeeMiniProfiler;
// options.ResultsListAuthorize = request => MyGetUserFunction(request).CanSeeMiniProfiler;
// Or, there are async versions available:
// options.ResultsAuthorizeAsync = async request => (await MyGetUserFunctionAsync(request)).CanSeeMiniProfiler;
// options.ResultsAuthorizeListAsync = async request => (await MyGetUserFunctionAsync(request)).CanSeeMiniProfilerLists;
// (Optional) To control which requests are profiled, use the Func<HttpRequest, bool> option:
// (default is everything should be profiled)
// options.ShouldProfile = request => MyShouldThisBeProfiledFunction(request);
// (Optional) Profiles are stored under a user ID, function to get it:
// (default is null, since above methods don't use it by default)
// options.UserIdProvider = request => MyGetUserIdFunction(request);
// (Optional) Swap out the entire profiler provider, if you want
// (default handles async and works fine for almost all applications)
// options.ProfilerProvider = new MyProfilerProvider();
// (Optional) You can disable "Connection Open()", "Connection Close()" (and async variant) tracking.
// (defaults to true, and connection opening/closing is tracked)
// options.TrackConnectionOpenClose = true;
// (Optional) Use something other than the "light" color scheme.
// (defaults to "light")
// options.ColorScheme = StackExchange.Profiling.ColorScheme.Auto;
// The below are newer options, available in .NET Core 3.0 and above:
// (Optional) You can disable MVC filter profiling
// (defaults to true, and filters are profiled)
// options.EnableMvcFilterProfiling = true;
// ...or only save filters that take over a certain millisecond duration (including their children)
// (defaults to null, and all filters are profiled)
// options.MvcFilterMinimumSaveMs = 1.0m;
// (Optional) You can disable MVC view profiling
// (defaults to true, and views are profiled)
// options.EnableMvcViewProfiling = true;
// ...or only save views that take over a certain millisecond duration (including their children)
// (defaults to null, and all views are profiled)
// options.MvcViewMinimumSaveMs = 1.0m;
// (Optional - not recommended) You can enable a heavy debug mode with stacks and tooltips when using memory storage
// It has a lot of overhead vs. normal profiling and should only be used with that in mind
// (defaults to false, debug/heavy mode is off)
//options.EnableDebugMode = true;
});
#endregion
_newLog.LogDebug("Generator");
services.AddSingleton<IHostedService, GeneratorService>();
@@ -373,7 +311,7 @@ namespace AyaNova
// {
// app.UseDeveloperExceptionPage();
// }
_newLog.LogDebug("Profiler");
_newLog.LogDebug("Profiler");
app.UseMiniProfiler();
//Store a reference to the dependency injection service for static classes