.net-core

Multiple routes to the same razor page

别等时光非礼了梦想. 提交于 2021-01-29 19:35:01
问题 Background I've got a razor page in my Asp.Net Core 3.1 website called SignupAndApply. It's effectively a copy and paste of the register identity page but: With some additional fields Allows an optional applyid to be passed as part of the route If I pass an applyId as part of the route, I make a couple of label changes to the page and redirect the user somewhere else I want to create two routes for this page: /identity/account/signupandapply/{applyId?} 'when the user is applying and signing

Sending logs from .net core application running in App Service to log analytics

帅比萌擦擦* 提交于 2021-01-29 19:28:01
问题 I tried looking for the simplest way of my .net core 2.0 application to send app logs to log analytics workspace. This application is running under App Service in azure, and I tried enabling the "Diagnostic Settings" and archiving the logs to log analytics. However, I am not seeing my app custom logs messages in: AppServiceHTTPLogs . I have used the following guide: https://azure.github.io/AppService/2019/11/01/App-Service-Integration-with-Azure-Monitor.html My application is using

What does MinimumLevel and Override mean in appsettings.json logging context?

寵の児 提交于 2021-01-29 19:13:48
问题 I am looking at the appsettings.json from Serilog sample project, which has the following snippet: "MinimumLevel": { "Default": "Debug", "Override": { "System": "Information", "Microsoft": "Information" } } In this context, what is the purpose of Override ? The System and Microsoft entries don't have a parent setting in the MinimumLevel node, so what is it overriding? Unless I am completely misunderstanding the purpose of Override . 回答1: By default, you're saying any log entry that is

AddAutoMapper does not load all assemblies in asp.net core

别来无恙 提交于 2021-01-29 18:53:05
问题 I have the following code that add automapper to my app. public void ConfigureServices(IServiceCollection services) { services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); services.AddHttpClient(); services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies()); } The AppDomain.CurrentDomain.GetAssemblies() returns only assemblies that were loaded at the time it is called. I can see that some of my assemblies which contain my mappings have not been yet loaded and as a

Filter SQL GROUP by a filter that is not in GROUP

时间秒杀一切 提交于 2021-01-29 18:39:23
问题 Im working on a stream service like app based on C# NET.Core. Im "pinging" the server from client every minute and then create a new SQL entry with time and ID of this viewer. Here is a example of 5 minutes of view: StreamViewerId | TrackDate 1 | 2020-09-25 05:05:00 1 | 2020-09-25 05:06:00 1 | 2020-09-25 05:07:00 1 | 2020-09-25 05:08:00 1 | 2020-09-25 05:09:00 1 | 2020-09-25 05:10:00 ... I need to make a "chart bars" based on that data and i cant make the graphic with 1 minute as xAxis, so i

Importing content-only package to DotNet Core 3.1 project in Visual Studio 16.6

守給你的承諾、 提交于 2021-01-29 18:02:38
问题 I have defined and created a content-only package to share JSON schemas between different projects. I packaged it using nuget.exe , and could successfully add it to .Net Framework 4.6 library project. But when I tried to add it to the DotNet Core 3.1 library project (NUnit tests) the following error occurred: NU1212 Invalid project-package combination for <package name>. DotnetToolReference project style can only contain references of the DotnetTool type Nuget support documentation (package

Is it possible to add a service from a controller or manager class other than the ConfigureService method

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-29 17:31:05
问题 I want to Use services.AddPredictionEnginePool<..> When I use "IServiceCollection DI" I receive the notification below Cannot instantiate implementation type 'Microsoft.Extensions.DependencyInjection.IServiceCollection' for service type 'Microsoft.Extensions.DependencyInjection.IServiceCollection'. How can I Use this; services.AddPredictionEnginePool<..> From other classes. Why I want do; The reason of the usage of the service is to add a new object in runtime. 回答1: IServiceCollection is the

Best practices on load a form inside a main form, both residing in an external DLL assembly

人走茶凉 提交于 2021-01-29 17:17:35
问题 I've loaded an external DLL into your project like this Dim assembly As Assembly = Assembly.LoadFile(libraryPath & "filename.dll") Dim type As Type = assembly.[GetType]("NameSpace.ClassName") // i'm loading as a form here but can be any control Dim frm As Form = TryCast(Activator.CreateInstance(type), Form) What are the best practices if you're loading a class or a control inside the loaded form (above) that resides also inside the same assembly ? for instance: Lets say you loaded an assembly

CORS request error even thought it's enabled in the .Net Core back end

為{幸葍}努か 提交于 2021-01-29 15:50:27
问题 I have a test app, which I want to send a request and get a token, but anyway I can't get it due to the cross request error in my back end in the configuration I have: public void ConfigureServices(IServiceCollection services) { services.AddCors(o => o.AddPolicy("MyPolicy", builder => { builder.AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader() .AllowCredentials().WithOrigins("http://localhost:4200"); })); and added the following on the Configure part: public void Configure

How to create Nuget package with nested dependencies

蓝咒 提交于 2021-01-29 15:43:41
问题 I'm working on a .NET Core solution. For one of the projects within the solution, I need to build a Nuget package. Project A has a reference to another project B in the solution, set up as a project reference. Project B has a dependency on a Nuget package C. Now, when I create a Nuget package for A, it includes A.dll and B.dll but not C.dll Can someone help me figure this out? How can I include all 3 .dlls? Thanks, Andy 回答1: See https://github.com/NuGet/Home/issues/3891 for the feature