.net-core

string.IndexOf get different result in .Net 5

自作多情 提交于 2021-02-06 10:18:26
问题 When i run following code in .Net Core 3.1 i get 6 //Net Core 3.1 string s = "Hello\r\nworld!"; int idx = s.IndexOf("\n"); Console.WriteLine(idx); Result 6 but when i run this code in .Net 5 i get different result. why? //NET 5 string s = "Hello\r\nworld!"; int idx = s.IndexOf("\n"); Console.WriteLine(idx); Result -1 回答1: The comments and @Ray's answer contain the reason. And though hacking the .csproj or runtimeconfig.json file may save your day the real solution is to specify the comparison

The author primary signature's timestamp found a chain building issue: UntrustedRoot: self signed certificate in certificate chain

浪尽此生 提交于 2021-02-05 20:40:49
问题 While doing a docker build on my .NET Core project, I got the following error on all my NuGets: 80.19 /app/GradingTool.Tests/GradingTool.Tests.csproj : error NU3028: Package 'Microsoft.EntityFrameworkCore 5.0.0' from source 'https://api.nuget.org/v3/index.json': The author primary signature's timestamp found a chain building issue: UntrustedRoot: self signed certificate in certificate chain [/app/GradingTool.sln] #12 80.20 /app/GradingTool.Tests/GradingTool.Tests.csproj : error NU3037:

How to create a signing certificate and use it in IdentityServer4 in production?

拈花ヽ惹草 提交于 2021-02-05 13:15:43
问题 Most (all?) the sample code on the IdentityServer4 docs site uses AddDeveloperSigningCredential() , but recommends using AddSigningCredential() instead in production. I spent more hours than I care to think about trying to figure out how to do that. How do I create a signing certificate and use it in IdentityServer4 in production? 回答1: Create certificate and add to machine's certificate store I decided to create a certificate and add it to the machine's certificate store. Brock Allen has a

Can I clone DbContext from existing one?

烂漫一生 提交于 2021-02-05 11:59:24
问题 I'm working on .NET Core Web API and I have one endpoint where I want to run three operations in parallel. All three of them use the same database, so I need three copies of DbContext. I created a simple Factory class, which I later inject into my "Data" class. Is it possible (if it's, is a good practice), to inject DbContext into my factory class (using built in .NET Core IoC) and when someone calls "CreateMyDbContext" method, just deep clone the one which was injected at the beginning? EDIT

Can I clone DbContext from existing one?

你离开我真会死。 提交于 2021-02-05 11:59:22
问题 I'm working on .NET Core Web API and I have one endpoint where I want to run three operations in parallel. All three of them use the same database, so I need three copies of DbContext. I created a simple Factory class, which I later inject into my "Data" class. Is it possible (if it's, is a good practice), to inject DbContext into my factory class (using built in .NET Core IoC) and when someone calls "CreateMyDbContext" method, just deep clone the one which was injected at the beginning? EDIT

Why the “.deps.json” file on release folder and publish output folder size are difference

﹥>﹥吖頭↗ 提交于 2021-02-05 11:52:35
问题 I build on project and checked on release folder size is "280KB" but when I try on publish output file size is "296KB" Tested on .net core 2.0 and VS 2017 回答1: The output in bin/[Configuration] is only meant to be used for local development. Together with the runtimeconfig.dev.json this file specifies the dependency closure of your build output and references are resolved from your local NuGet package cache. If you copy the build output to another machine/user, it will not work. For

Why the “.deps.json” file on release folder and publish output folder size are difference

左心房为你撑大大i 提交于 2021-02-05 11:52:30
问题 I build on project and checked on release folder size is "280KB" but when I try on publish output file size is "296KB" Tested on .net core 2.0 and VS 2017 回答1: The output in bin/[Configuration] is only meant to be used for local development. Together with the runtimeconfig.dev.json this file specifies the dependency closure of your build output and references are resolved from your local NuGet package cache. If you copy the build output to another machine/user, it will not work. For

Error while using CosmosDB provider for Entity Framework Core with Azure Tables

99封情书 提交于 2021-02-05 11:42:43
问题 I'm trying to do a simple CRUD application with EF Core and Azure Table (from Azure Storage Account). I'm passing name of the storage account as database name (The docs aren't exactly clear on that) services.AddDbContext<HomioDbContext>(options => options.UseCosmos( "https://homiostorage.table.core.windows.net/", "{Account Key}", databaseName: "{name of storage account}")); Doing any db operation throws following error ( The value for one of the HTTP headers is not in the correct format )

Multimatch query with Fuzzy NEST - ElasticSearch

爱⌒轻易说出口 提交于 2021-02-05 10:47:51
问题 I wrote the following query to check multiple fields from a value and it's work: var searchResponse = client.Search<Document>(s => s .Query(q => q .MultiMatch(a => a .Fields(f => f .Field(p => p.Attachment.Content) .Field(p => p.FileName)) .Query(queryValue)))); I would achieve the same result (search the queryValue in fields Attachment.Content and FileName) but with the Fuzzy mechanism (for example, if queryValue is "esting" I would get back also a result with filename "testing"). Thanks a

Do you have to have .net core installed on a system before using self contained apps?

我怕爱的太早我们不能终老 提交于 2021-02-05 09:40:45
问题 I'm using Visual Studio 2019 to publish a self contained .net core 2.1 app. Many files are emitted during the publishing (application files as well as core libraries). But there is no dotnet.exe included in the published files. Without a dotnet.exe I can't launch the published app! So I'm confused. Must you have a system wide .net core installed to use self-contained apps, and if so, then you're app certainly isn't self contained. 回答1: A self-contained app will contain everything needed to