asp.net-core-2.1

In Audit.Net is there a way to use multiple output provider?

北城余情 提交于 2020-08-09 14:09:17
问题 I tried setting up the configuration below however, I think only one of them is being used. Is there a way to chain the two or is there any other way to use multiple output provider? Audit.Core.Configuration.Setup() .UseElasticsearch(config => config .ConnectionSettings(new Uri(elasticUri)) .Index("sample-index") .Id(ev => Guid.NewGuid())); Audit.Core.Configuration.Setup() .UseUdp(config => config .RemoteAddress("127.0.0.1") .RemotePort(6060)); 回答1: The DataProvider is globally shared across

How can I increase the JSON deserialization MaxDepth limit in my ASP.NET Core webapp

╄→尐↘猪︶ㄣ 提交于 2020-08-07 07:50:52
问题 We're using ASP.NET Core 2.1 with .NET Framework 4.6.2. We have a customer who needs to send up a rather largely nested json structure to our webapp. When they make this call, we're outputting the following log and returning an error: The reader's MaxDepth of 32 has been exceeded. Path ' super.long.path.to property ', line 1, position 42111." I've looked through the ASP.NET Core codebase, and have observed a couple of references to MaxDepth = 32 in the deserializer provided with the framework

How can I increase the JSON deserialization MaxDepth limit in my ASP.NET Core webapp

我与影子孤独终老i 提交于 2020-08-07 07:49:56
问题 We're using ASP.NET Core 2.1 with .NET Framework 4.6.2. We have a customer who needs to send up a rather largely nested json structure to our webapp. When they make this call, we're outputting the following log and returning an error: The reader's MaxDepth of 32 has been exceeded. Path ' super.long.path.to property ', line 1, position 42111." I've looked through the ASP.NET Core codebase, and have observed a couple of references to MaxDepth = 32 in the deserializer provided with the framework

ASP.NET Core 2.1: Navigating back to a page after an HTTP POST fails validation displays a browser error

不羁的心 提交于 2020-08-01 12:47:08
问题 Problem: Using an ASP.NET Core 2.1 MVC project, I'm receiving the following browser error message after using the browser back button to return to a form, where the form POST failed server-side validation: Error message in Firefox: Document Expired This document is no longer available. The requested document is not available in Firefox’s cache. As a security precaution, Firefox does not automatically re-request sensitive documents. Click Try Again to re-request the document from the website.

Error on published ASP.NET core site: Cannot find compilation library location for package 'Microsoft.AspNet.WebApi.Client'

久未见 提交于 2020-07-06 11:31:08
问题 My webb app works fine when run from Visual Studio, but when I publish and try to load a page, I get: InvalidOperationException: Cannot find compilation library location for package 'Microsoft.AspNet.WebApi.Client' Microsoft.Extensions.DependencyModel.CompilationLibrary.ResolveReferencePaths(ICompilationAssemblyResolver resolver, List assemblies) I've been stuck on this for quite a while. I've attempted to apply the various workarounds in the thread https://github.com/dotnet/core-setup/issues

Does EF core compares value to include columns in update statement?

烈酒焚心 提交于 2020-06-28 05:25:17
问题 I have the following code var dbContext = Setup.ConfigureDBContext(); var wo = await dbContext.WorkOrders.Where(x => x.WorkOrderID == 88).SingleOrDefaultAsync(); var t = wo.Confidence; wo.ModifiedDateTime = DateTime.UtcNow; wo.Confidence = t; await dbContext.SaveChangesAsync(); in the above query i am assigning the same Confidence but changing the ModifiedDateTime EF generates the following SQL exec sp_executesql N'SET NOCOUNT ON; UPDATE [WorkOrders] SET [ModifiedDateTime] = @p0 WHERE

Handling Expired Refresh Tokens in ASP.NET Core

感情迁移 提交于 2020-06-24 07:16:11
问题 SEE Below for code that solved this issue I'm trying to find the best and most efficient way to deal with a refresh token that has expired within ASP.NET Core 2.1. Let me explain a bit more. I am using OAUTH2 and OIDC to request Authorization Code grant flows (or Hybrid flow with OIDC). This flow/grant type gives me access to an AccessToken, and a RefreshToken (Authorization Code as well, but that is not for this question). The access token and refresh token are stored by ASP.NET core, and

What is the difference between UseStaticFiles, UseSpaStaticFiles, and UseSpa in ASP.NET Core 2.1?

风格不统一 提交于 2020-06-07 09:11:07
问题 ASP.NET Core 2.1.1 offers several seemingly related extension methods for appBuilder: UseStaticFiles from Microsoft.AspNetCore.StaticFiles UseSpaStaticFiles from Microsoft.AspNetCore.SpaServices.Extensions UseSpa from Microsoft.AspNetCore.SpaServices.Extensions Please help me make sense of their purpose and relation to each other? Also, is there any difference from the server execution standpoint if I run these methods in a different order (e.g. app.UseStaticFiles() -> app.UseSpaStaticFiles()

GoogleSmarthome JWT Creation

那年仲夏 提交于 2020-06-01 05:29:27
问题 The documentation is at Using OAuth 2.0 for Server to Server Applications You will notice in the documentation the disclaimer "don't do this but use the libraries". Unfortunately, there does NOT appear to be .Net Core libraries and I have suggested to the Smarthome program managers that support for .Net Core should be the same as provided for Java, node.js and Python. However, I'm hunkered down, socially distanced and have some time available so I gave it a shot. There are a lot of moving

How do I test an https redirect in ASP.NET Core?

自闭症网瘾萝莉.ら 提交于 2020-05-15 15:12:30
问题 Recently, I came up with unit tests for checking some redirect rules of my ASP.NET Core 2.1 application: [Fact(DisplayName = "lowercase path")] public async Task LowercaseRedirect() { var result = await this.Client.GetAsync("/BLOG/"); Assert.EndsWith("/blog/", result.RequestMessage.RequestUri.PathAndQuery, StringComparison.InvariantCulture); } [Fact(DisplayName = "add missing slash")] public async Task SlashRedirect() { var result = await this.Client.GetAsync("/blog"); Assert.EndsWith("/blog/