asp.net-core-2.1

.NET Core 2.1 Swashbuckle - group controllers by area

天大地大妈咪最大 提交于 2021-02-09 20:29:51
问题 My situation is rather simple. I have a very large .NET Core 2.1 MVC/WebApi divided into several Areas, representing different modules of my system. I use Swagger (SwashBuckle) and it works very well. My routing are like {area}/{controller}/{action} . In Swagger UI, every action is grouped into the controllers (standard behaviour). My list of controllers and operations is becoming very very large and hard to grasp. Because of that, i would love if Swagger could divide my controllers into the

Unable to post values from angular service to Web API in asp.net core angular

…衆ロ難τιáo~ 提交于 2021-02-08 09:55:04
问题 I am working on asp.net core(2.1) angular project, here I am passing parameters from angular service to web API but I am not getting those values in API. Below is my code, it was working fine when I was using a separate project for Web API. Now as I have created a controller inside the asp.net core project itself I am unable to get posted values in API parameter list. Do I need to add/change some settings to get values from angular service to API call? Angular Service : getSortedPagedResults

Log UserName and IP with Custom Properties in Application Insight .Net Core 2.1

断了今生、忘了曾经 提交于 2021-02-07 23:02:51
问题 We are running an intranet Application on .Net Core 2.0. Application insight is very helpfull to catch exceptions. So when the User comes up to us for support we would like to find his request that caused problems in application insight. I added an ClientIpHeaderTelemetryInitializer like this: public class CustomTelemetry : ClientIpHeaderTelemetryInitializer { private readonly IHttpContextAccessor _httpContextAccessor ; public CustomTelemetry(IHttpContextAccessor httpContextAccessor) : base

Does nhibernate 5.2.3 support .netcore 2.1?

廉价感情. 提交于 2021-02-07 11:00:49
问题 nhibernate nuget package docs The nhibernate 5.2.3 docs say it supports .netcore 2.0 but Does nhibernate 5.2.3 also support .netcore 2.1? 回答1: Yes, NHibernate 5.1.3 or later support .Net Standard 2.0 , can be used with .net core 2.1 or .net framework 4.6.1 which support .net standard 2.0. please refer to the repo https://github.com/nhibernate/NHibernate.AspNetCore.Identity?files=1 for more information. 来源: https://stackoverflow.com/questions/54533122/does-nhibernate-5-2-3-support-netcore-2-1

Does nhibernate 5.2.3 support .netcore 2.1?

北战南征 提交于 2021-02-07 10:59:34
问题 nhibernate nuget package docs The nhibernate 5.2.3 docs say it supports .netcore 2.0 but Does nhibernate 5.2.3 also support .netcore 2.1? 回答1: Yes, NHibernate 5.1.3 or later support .Net Standard 2.0 , can be used with .net core 2.1 or .net framework 4.6.1 which support .net standard 2.0. please refer to the repo https://github.com/nhibernate/NHibernate.AspNetCore.Identity?files=1 for more information. 来源: https://stackoverflow.com/questions/54533122/does-nhibernate-5-2-3-support-netcore-2-1

In Swagger UI, how can I remove the padlock icon from “anonymous” methods?

﹥>﹥吖頭↗ 提交于 2021-02-07 02:49:32
问题 I'm creating an API with .Net Core 2.1 and using JSON Web Token (JWT) for authentication. I have 2 controllers: AuthenticationController and UserController . I have decorated AuthenticationController with [AllowAnonymous] and UserController with [Authorize] . Swagger is working correctly: it allows me to hit the endpoints in AuthenticationController (SignUp/SignIn) without requesting authorization, and it does request JWT to hit the endpoints in UserController . However, in Swagger UI, every

Url.Page creates wrong url

风格不统一 提交于 2021-02-05 09:11:44
问题 Have a look at this code: var callbackUrl = Url.Page("/Account/ConfirmEmail", null, new { userId = user.Id, code }, Request.Scheme); The result is this: http://localhost:5000/Account/Register?userId=614d16ae-4e95-4796-8d67-cb829e12585b&code=CfDJ8OeNFdnFCrtCsRU7ofatUuROudlTo%2BFQe84oAiL%2BPJSoYwGH9q1Xadg8XBbpOFg5DiRH1vDoGeQ8l3qIFHjB3NMM3ZDTlQexawj1b%2BJ7P6X3SHoBsYs7jLYwcfGQCbnk1SJA5koFkoDcWj04nsjzQlJMe8ttR0DFdi%2B6TTbWI8WkPBaS083O3aU%2BL2bbYGNwwikhrkbB0nHy4PRzK1LZuZo%3D&page=%2FAccount

How does contravariance work with Func delegate in .net core

心已入冬 提交于 2021-02-05 07:00:52
问题 I have the following piece of code where I am trying to write a generic validation rule for my domain objects. while doing so I have an issue to deal Func delegate supporting variance public class Person { } public class Employee : Person { } internal interface IValidation<T> where T: Person { void AddValidationRule(Func<T,bool> predicateFunction); } internal class BaseValidation : IValidation<Person> { void IValidation<Person>.RegisterValidationRules(Person person) { } } internal class

Service Model Assembly Error With Azure Functions V2+ (.net Core 2.1)

不想你离开。 提交于 2021-01-29 12:49:00
问题 I have been using azure function V2(.net core 2.1) in my azure function app. I have been using System.ServiceModel.Primitives nuget for my function App which uses ServiceBusEnvironment packages in it. I am able to compile the code and run the function. While calling the function I get this runtime error. Could not load type 'System.ServiceModel.Channels.IBindingRuntimePreferences' from assembly 'System.ServiceModel, Version=4.0.0.0' I googled up many things. But no luck. I then tried by

How to mock the new HttpClientFactory in .NET Core 2.1 using Moq

梦想的初衷 提交于 2021-01-29 10:00:44
问题 .NET Core 2.1 comes with this new factory called HttpClientFactory , but I can't figure out how to mock it to unit test some methods that include REST service calls. The factory is being injected using .NET Core IoC container, and what the method does is create a new client from the factory: var client = _httpClientFactory.CreateClient(); And then using the client to get data from a REST service: var result = await client.GetStringAsync(url); 回答1: The HttpClientFactory is derived from