asp.net-core-2.2 Questions

2

Solved

I upgrade my netcore 2.1 project to 2.2 and i have a problem with my swagger page. Previously in swagger bad response it only show "Bad Request" without the model. But after i upgraded to net cor...
Triode asked 28/5, 2019 at 11:56

2

Solved

I'm migrating a full .NET Framework Web API 2 REST project over to ASP.NET Core 2.2 and getting a bit lost in the routing. In Web API 2 I was able to overload routes with the same number of parame...

2

When I use Bearer token with an AspNetCore controller protected with [Authorize], I get the log message: info: Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationHandler[7] Identity....

5

Solved

What I am trying to do: I am attempting to upload a multipart/form-data with a file and a JSON blob using Postman to an ASP.NET Core 2.2 APIController and stream the file to a temporary file on th...
Zipper asked 8/4, 2019 at 21:56

4

Solved

Does any one know if it is possible to host multiple instances of WebApplicationFactory<TStartup>() in the same unit test? I have tried and can't seem to get anywhere with this one issue. i.e...

2

Solved

Although the automatic 400 response is useful, I don't want to send validation errors to the client. This is the response body: { "errors": { "username": [ "'username' must not be empty." ], ...
Reeding asked 23/4, 2019 at 12:38

3

Solved

In my dotnet core 2.2 application I am trying to enable two factor authentication. In the startup class I have created a seed data function that will generate a sample user. I use UserManager to cr...

5

Solved

I am trying to prevent the app to redirect to /Account/Login in asp.net core 2.2 when the user isn't logged in. Even though i write LoginPath = new PathString("/api/contests"); any unauth...
Carrell asked 25/12, 2018 at 21:1

2

Solved

On an ASP.NET Core 2.2 controller I have the following: var url = _linkGenerator.GetUriByAction(HttpContext, action: "GetContentByFileId", values: new { FileId = 1 }); I injected LinkGenerator i...
Sirius asked 21/1, 2019 at 23:55

5

Solved

Microsoft's ASP.NET Core documentation briefly mentions that you can implement IValidateOptions<TOptions> to validate configuration settings from appsettings.json, but a complete example is n...
Marius asked 21/7, 2019 at 18:1

1

In my .net core mvc (2.2) application I have a configuration, configured from the database. How to reload the configuration from the controller, for example after changing some values in the databa...
Gastrovascular asked 5/11, 2019 at 15:11

2

Solved

I'm working with the ASP.NET Core 2.2 project where I need to return JavaScript from the controller. However, I suspect that there is no direct way, hence, I followed this OS answer and changed my ...
Fluoric asked 14/8, 2019 at 7:15

2

Solved

After moving a class through projects, one of the IConfiguration methods, GetValue<T>, stopped working. The usage is like this: using Newtonsoft.Json; using System; using System.Net; using Sy...
Brashy asked 19/2, 2019 at 13:43

2

How to localize standard error messages of validation attributes in ASP.NET Core (v2.2)? For Example, [Required] attribute has this error message "The xxx field is required."; [EmailAddress] has "T...

7

I'm deploying my .net core app on IIS server and facing the issue in swagger UI where swagger.json not found. When I run it locally (Development environment) everything is working perfectly but whe...
Mylohyoid asked 28/1, 2019 at 17:14

2

Solved

Until Asp.Net Core 2.1, I was using below code in order to redirect default route to swagger endpoint. app.UseMvc(builder => { builder.MapRoute("default", template: "api/{controller}/{action}/...

5

In Startup.ConfigureServices() I configure authorization filter like this: services.AddMvc(options => { options.Filters.Add(new AuthorizeFilter(myAuthorizationPolicy)); }) and I use either c...
Bornite asked 31/1, 2019 at 12:55

2

Solved

I get the following error when tring to run dotnet publish: The process cannot access the file because it is being used by another process. This appears to happen when you try to publish your...
Welcher asked 16/7, 2019 at 16:58

1

We're wondering if reverse proxy is actually required for most use cases and would appreciate additional information. The Kerstel/Nginx documentation claims: Kestrel is great for serving dynamic c...

2

Solved

On an ASP.NET Core 2.2 Controller I tried to generate a Link in 3 ways: var a = Url.Action(action: "GetContentByFileId", values: new { fileId = 1 }); var b = _linkGenerator.GetUriByAction(HttpCon...
Salleysalli asked 22/1, 2019 at 10:16

2

Solved

I have an existing API, that is reading data from the request body: [HttpPost] public async Task<IActionResult> Post([FromBody] CreateVm vm) { if (!ModelState.IsValid) return BadRequest(); ...
Withdrawn asked 17/10, 2019 at 11:45

2

Solved

I am using Swashbuckle.AspNetCore 5.0.0-rc2 in one of my .Net Core 2.2 REST projects. Within my project I am serving two different apis which are logically connected to each other. Today, I manag...
Ustkamenogorsk asked 4/11, 2019 at 13:15

5

Solved

I tried this: Read request body twice and this: https://github.com/aspnet/Mvc/issues/4962 but did not work. I read request body like this: app.Use(async (context, next) => { var requestBody = ...
Willhite asked 30/1, 2019 at 14:12

3

Solved

How can I make an class instance manually of a class that requires an IOptionsMonitor in the constructor? My Class private readonly AuthenticationSettings _authenticationSettings; public ActiveD...
Duenas asked 2/5, 2019 at 10:58

3

Solved

I am trying to configure the handling of certain HTTP Response Status Codes in the middleware of my ASP.NET Core 2.2 MVC app using this example code from Microsoft docs: app.UseStatusCodePages(asy...
Kinaesthesia asked 3/5, 2019 at 15:12

© 2022 - 2024 — McMap. All rights reserved.