.net-core

Including an unmanaged native library files to nuget output directory

懵懂的女人 提交于 2021-01-27 12:59:27
问题 unamanged shared object (.so file) does not copy to the output directory: I have .netstandard 2 project that wraps a c++ library(lets call the project wrap.csproj). That project depends on shared object (libgdal.so). I want to use this project as a nuget, and therefor, the projects that will reference my nuget should have the wrap.dll and the libgdal.so in the build/publish folder. I packed this project as nuget. but projects( dotnet core) that reference this nuget does not get the libgdal.so

How to add an App.Config in Visual Studio Code?

余生颓废 提交于 2021-01-27 12:29:39
问题 How to configure a C# program with a connection string in Visual Studio Code? This is for .Net Core 2.2 using .Net Core SDK version 2.2.203 in Visual Studio Code 1.34.0 I have tried to add App.Config file to the project, but I'm not able to resolve this issue. Do let me know any solution to configure connection string. using System; using System.Collections.Generic; using System.Data; using System.Data.Common; using System.Data.SqlClient; using System.Linq; using System.Web; using System

How to get user claims inside ASP Core 2 method without Authorize attribute?

限于喜欢 提交于 2021-01-27 12:09:34
问题 I have a method on an API that can be accessed anonymously. I want to use resource authorization to determine if the user has access. If the object is "public" than it can be accessed by anyone (including anonymous users). If the object is "private" than it can only be viewed by logged in users. This logic works fine if I have an authorize attribute on the method, but if not the User has no claims even when they are logged in. Is there a way to get the user's claims in a method without an

HttpClient in .netcore is automatically adding a space in header

杀马特。学长 韩版系。学妹 提交于 2021-01-27 08:04:22
问题 I'm using HTTPClient in .netcore but I'm facing an issue when I add a custom accept header. var client = new HttpClient { Timeout = new TimeSpan(0, 5, 0)}; client.DefaultRequestHeaders.Clear(); client.DefaultRequestHeaders.TryAddWithoutValidation("Accept", "application/vnd.pagseguro.com.br.v3+json;charset=ISO-8859-1"); But after this, what I see is that a space has been automaticaly added, resulting in " application/vnd.pagseguro.com.br.v3+json; charset=ISO-8859-1 ". That space is causing me

HttpClient in .netcore is automatically adding a space in header

被刻印的时光 ゝ 提交于 2021-01-27 07:55:16
问题 I'm using HTTPClient in .netcore but I'm facing an issue when I add a custom accept header. var client = new HttpClient { Timeout = new TimeSpan(0, 5, 0)}; client.DefaultRequestHeaders.Clear(); client.DefaultRequestHeaders.TryAddWithoutValidation("Accept", "application/vnd.pagseguro.com.br.v3+json;charset=ISO-8859-1"); But after this, what I see is that a space has been automaticaly added, resulting in " application/vnd.pagseguro.com.br.v3+json; charset=ISO-8859-1 ". That space is causing me

Configuring WCF client binding to use X509 certificate in dotnet core 2.2

蹲街弑〆低调 提交于 2021-01-27 07:39:09
问题 I'm trying to convert an old WCF client to dotnet core. I successfully generated my proxies from the wsdl and have been trying to configure them so I can successfully call the endpoint. It appears, based on some googling, that under dotnet core I need to configure my WCF client from code. Here's the WCF configuration section from the web.config of the old application: <system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" /> <behaviors> <endpointBehaviors>

EF Core - circular reference and serializing to json

岁酱吖の 提交于 2021-01-27 07:35:14
问题 Example of entities: public class HistoryWorkoutExercise : EntityMaximum { /// <summary> /// Gets or sets the Weight. /// </summary> public decimal? Weight { get; set; } /// <summary> /// Gets or sets the Speed. /// </summary> public decimal? Speed { get; set; } /// <summary> /// Gets or sets the Time. /// </summary> public decimal? Time { get; set; } public int NumberOfRepetitions { get; set; } public int NumberOfCompletedRepetitions { get; set; } public int ExerciseId { get; set; } public

EF Core - circular reference and serializing to json

旧城冷巷雨未停 提交于 2021-01-27 07:34:56
问题 Example of entities: public class HistoryWorkoutExercise : EntityMaximum { /// <summary> /// Gets or sets the Weight. /// </summary> public decimal? Weight { get; set; } /// <summary> /// Gets or sets the Speed. /// </summary> public decimal? Speed { get; set; } /// <summary> /// Gets or sets the Time. /// </summary> public decimal? Time { get; set; } public int NumberOfRepetitions { get; set; } public int NumberOfCompletedRepetitions { get; set; } public int ExerciseId { get; set; } public

Configuring WCF client binding to use X509 certificate in dotnet core 2.2

为君一笑 提交于 2021-01-27 07:34:43
问题 I'm trying to convert an old WCF client to dotnet core. I successfully generated my proxies from the wsdl and have been trying to configure them so I can successfully call the endpoint. It appears, based on some googling, that under dotnet core I need to configure my WCF client from code. Here's the WCF configuration section from the web.config of the old application: <system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" /> <behaviors> <endpointBehaviors>

Web App on Azure loaded slow after applying custom domain

若如初见. 提交于 2021-01-27 07:26:37
问题 I just started hosting my website on Azure. Initially when uploading and hosting the website on xxxx.azurewebsites.net, the performance and response was great. After adding a custom domain (Bought from Godaddy), the performance became worst and it would take 1 min for a page to load. xxxx.azurewebsites.net -> loaded in few seconds xxxx.com -> loaded in almost a minute Is there anything im missing here? In General Configuration, I have enabled Always On but the performance is still the same