asp.net-core-2.1

“500 - Internal server error” when calling ASP .Net Core 2.1 Web API on Windows Server

守給你的承諾、 提交于 2021-02-19 04:32:38
问题 I have an ASP .Net Core 2.1 Web API which I've deployed to a new server we recently purchased (running Windows Server 2016 Standard). The API works perfectly on both my development PC and our old server (running Windows Server 2012 R2). But on this new server, I get this error: 500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed. I remember a year ago also struggling a lot trying to get it to run on our old server. I did eventually

Asp.net Core Middleware that cancel a request if taking to long

送分小仙女□ 提交于 2021-02-18 18:57:15
问题 I need a middleware to cancel a request if my api is taking more than x amount of time. All my api calls are asynch and cancellable: public async Task<IActionResult> Get(CancellationToken token) { } ... public async Task InvokeAsync(HttpContext context) { //.... int customDurationMilis = 1000; //1second cancellTimer = new Timer(CancellRequestCallBack, context, customDurationMilis, Timeout.Infinite); //... await _next(context); } private void CancellRequestCallBack(HttpContext context) { //log

Use SSL Certificate in ASP.NET Core 2.1 while Developing

霸气de小男生 提交于 2021-02-17 14:54:16
问题 On an ASP.NET Core 2.1 I application appSettings file I have the following: "Kestrel": { "Certificates": { "Default": { "Path": "localhost.pfx", "Password": "1234" } } } I created the certificate using the dotnet command: dotnet dev-certs https -ep "localhost.pfx" -p 1234 And I copied the localhost.pfx file to the project root along the appSettings file. When I run the project on http://localhost:5000 it is redirected to https://localhost:5001. However, I receive the browser error saying the

How to reconnect redis client after redis server reboot/scale

别来无恙 提交于 2021-02-11 12:55:52
问题 I have an azure app service (based on Docker) that uses Redis as a cache memory. When I reboot/scale redis server, redis client inside azure app service lose connection with server and throws the following exception: Timeout awaiting response (outbound=0KiB, inbound=0KiB, 2852ms elapsed, timeout is 2000ms), command=SETEX, next: GET test, inst: 0, qu: 0, qs: 45, aw: False, rs: ReadAsync, ws: Idle, in: 0, serverEndpoint: Unspecified/redis-server-com:6380, mgr: 10 of 10 available, clientName:

How to send Parameter/Query in HubConnection SignalR Core 2.1

为君一笑 提交于 2021-02-10 14:50:32
问题 I'm trying to send parameters into connection to signalr Connection = new HubConnectionBuilder() .WithUrl("https://familyapp.azurewebsites.net/StoreHub?token=123") .Build(); await Connection.StartAsync(); In my server side i take this parameter from HttpContext: public override async Task OnConnectedAsync() { var group = Context.GetHttpContext().Request.Query["token"]; string value = !string.IsNullOrEmpty(group.ToString()) ? group.ToString() : "default"; await Groups.AddToGroupAsync(Context

How to protect Asp.net core 2.1 and Vue.js single page application with Identity Server 4

…衆ロ難τιáo~ 提交于 2021-02-10 14:35:23
问题 Actually I am having a small confusion related to architect as I have 2 separated application and 1 Identity Server4 Application, one of AspNet core 2.1 API solution which is running on different domain and server and same with other 2. Now I have below points: Have added my Client Application (which is Vue.js SPA) as client in Identity Server4 with Implicit mode as it is Js client Do I need to add The API application as a client in IDP Server. If yes then How to call any API from VUE.js with

How can I close the client-side JavaScript 'Hub' connection in SignalR?

坚强是说给别人听的谎言 提交于 2021-02-10 13:16:57
问题 I have followed this tutorial. But there is no hint how to close the Websocket connection via the HubConnection class in signalr.js -file. The file is V1.0.4. This solution does not resolve my problem because I am using the microsofts javascript-library. Here ist the code: var lHubConnection = null; var Init = function () { // create instance lHubConnection = new signalR.lHubConnectionBuilder().withUrl("/chatHub").build(); // receive message lHubConnection.on("ReceiveMessage", function

.NET Core 2.1 Swashbuckle - group controllers by area

拜拜、爱过 提交于 2021-02-09 20:32:28
问题 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

.NET Core 2.1 Swashbuckle - group controllers by area

自作多情 提交于 2021-02-09 20:30:54
问题 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

.NET Core 2.1 Swashbuckle - group controllers by area

不问归期 提交于 2021-02-09 20:30:12
问题 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