.net-core

Serilog - Separate files for Information, exception using appsetting.json

ぃ、小莉子 提交于 2021-01-01 09:35:09
问题 I am writing all logs into one file(s) using rolling. But I want to separate them by Information , Warning and Exceptions rolling files. my current configuration is like this "Serilog": { "WriteTo": [ { "Name": "RollingFile", "Args": { "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] {Message}{NewLine}{Exception}", "pathFormat": "logs\\log-{Hour}.log", "rollOnFileSizeLimit ": true, "retainedFileCountLimit ": null, "rollingInterval": "Hour", "fileSizeLimitBytes": 5000000 }

Serilog - Separate files for Information, exception using appsetting.json

浪子不回头ぞ 提交于 2021-01-01 09:34:54
问题 I am writing all logs into one file(s) using rolling. But I want to separate them by Information , Warning and Exceptions rolling files. my current configuration is like this "Serilog": { "WriteTo": [ { "Name": "RollingFile", "Args": { "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] {Message}{NewLine}{Exception}", "pathFormat": "logs\\log-{Hour}.log", "rollOnFileSizeLimit ": true, "retainedFileCountLimit ": null, "rollingInterval": "Hour", "fileSizeLimitBytes": 5000000 }

Loading data on component load

拟墨画扇 提交于 2021-01-01 08:14:58
问题 One would think this is an easy task. But how do I call a service method on component load without it firing twice? Currently - protected override async Task OnInitializedAsync() { await Initialize(); } private async Task Initialize() { Video = await _VideoService.GetAsync(Id); } Right now this gets called twice, which doens't seem like a good idea to hit the database twice for the same information. I've tried just having this below, but it will throw an error before it even renders everytime

Nuget Semver - what are allowed prerelease characters?

半世苍凉 提交于 2021-01-01 07:08:15
问题 I'm trying to use semantiv versioning for one of my .Nuget Packages (.Net Core 2) The Version looks like this 1.0.0-my_fancy_branch.123. As you can guess, I try to set the branch name and the current BuildId as a prerelease tag. Unfortunately, dotnet build spews this error: ... is not a valid version string. But why? The absolutely great documentation of dotnet push / nuget does not list any forbidden characters. And I thought PIP is obtuse... 回答1: According to the reference on NuGet package

Nuget Semver - what are allowed prerelease characters?

被刻印的时光 ゝ 提交于 2021-01-01 07:06:53
问题 I'm trying to use semantiv versioning for one of my .Nuget Packages (.Net Core 2) The Version looks like this 1.0.0-my_fancy_branch.123. As you can guess, I try to set the branch name and the current BuildId as a prerelease tag. Unfortunately, dotnet build spews this error: ... is not a valid version string. But why? The absolutely great documentation of dotnet push / nuget does not list any forbidden characters. And I thought PIP is obtuse... 回答1: According to the reference on NuGet package

Dependency Injection in ASP.NET Core Worker Service

北慕城南 提交于 2020-12-31 20:06:36
问题 I'm facing some dependency injection issues in .NET Core Worker Service. Please see the below code in Program.cs file. public static void Main(string[] args) { Log.Logger = new LoggerConfiguration() .MinimumLevel.Debug() .MinimumLevel.Override("Microsof)t", LogEventLevel.Warning) .Enrich.FromLogContext() .WriteTo.File(@"C:\MyApp_Log\Log.txt") .CreateLogger(); try { Log.Information("Starting up the service."); CreateHostBuilder(args).Build().Run(); return; } catch (Exception ex) { Log.Fatal(ex

Dependency Injection in ASP.NET Core Worker Service

陌路散爱 提交于 2020-12-31 20:00:17
问题 I'm facing some dependency injection issues in .NET Core Worker Service. Please see the below code in Program.cs file. public static void Main(string[] args) { Log.Logger = new LoggerConfiguration() .MinimumLevel.Debug() .MinimumLevel.Override("Microsof)t", LogEventLevel.Warning) .Enrich.FromLogContext() .WriteTo.File(@"C:\MyApp_Log\Log.txt") .CreateLogger(); try { Log.Information("Starting up the service."); CreateHostBuilder(args).Build().Run(); return; } catch (Exception ex) { Log.Fatal(ex

Send parallel requests but only one per host with HttpClient and Polly to gracefully handle 429 responses

空扰寡人 提交于 2020-12-31 04:31:08
问题 Intro: I am building a single-node web crawler to simply validate URLs are 200 OK in a .NET Core console application. I have a collection of URLs at different hosts to which I am sending requests with HttpClient . I am fairly new to using Polly and TPL Dataflow. Requirements: I want to support sending multiple HTTP requests in parallel with a configurable MaxDegreeOfParallelism . I want to limit the number of parallel requests to any given host to 1 (or configurable). This is in order to

Published .Net Core App Warns to Install .Net Core but it's Already Installed

╄→尐↘猪︶ㄣ 提交于 2020-12-31 01:45:42
问题 I made a WPF and Console application for someone to use on their private server which I can't have access to. I used Visual Studio 2019's built-in "Publishing Wizard" to create Framework Dependant single-file apps. When the person opened the WPF app they were greeted with the standard warning: They clicked yes and to my understanding, they installed .Net Core 3.1 which is what the applications target. After they restarted the computer they got the exact same warning again. I wasn't sure what

Published .Net Core App Warns to Install .Net Core but it's Already Installed

喜你入骨 提交于 2020-12-31 01:40:47
问题 I made a WPF and Console application for someone to use on their private server which I can't have access to. I used Visual Studio 2019's built-in "Publishing Wizard" to create Framework Dependant single-file apps. When the person opened the WPF app they were greeted with the standard warning: They clicked yes and to my understanding, they installed .Net Core 3.1 which is what the applications target. After they restarted the computer they got the exact same warning again. I wasn't sure what