Questions tagged [asp.net-core-3.1]

Use this tag for questions specifically related to ASP.NET Core 3.1, in addition to using the 'ASP.NET Core' tag.

ASP.NET Core 3.1 is the Long Term Support version of ASP.NET Core running on .NET Core 3.1. It's included in Visual Studio 2019 16.4

See the tag for more information or ASP.NET Core Updates in .NET Core 3.1

2338 questions
38
votes
6 answers

Form submit resulting in "InvalidDataException: Form value count limit 1024 exceeded."

I have created an mvc site and I'm posting a large amount of json form data (Content-Type:application/x-www-form-urlencoded) back to the mvc controller. When I do this, I receive a 500 response that states: "InvalidDataException: Form value count…
19
votes
4 answers

Microsoft Visual Studio 2019: The project file cannot be opened. Unable to locate the .NET SDK

I just upgraded my visual studio 2019 to latest version 16.8.3 and suddenly I am not able to load any C# project and getting the following error for all .NET core projects: The project file cannot be opened. Unable to locate the .NET SDK. Check…
Dadwals
  • 451
  • 4
  • 13
18
votes
1 answer

Unable to bind to http://localhost:5000 on the IPv6 loopback interface: 'Cannot assign requested address'

I am using asp.net core 3.1 docker enabled project template (VS2019) to develop a web API. There are no compilation errors. While running the project, in the output window of the VS2019 I see the following message: Unable to bind to…
santosh kumar patro
  • 5,491
  • 12
  • 48
  • 105
15
votes
1 answer

How to use alert(),confirm() and prompt() function using Blazor?

I am learning the Blazor technology. I started a default increment project in VS 2019 and I have modified the code for Decrement with confirm() and alert but it does not work. @page "/counter"

Counter

Current count:…

15
votes
1 answer

Disable layout for page under Blazor

In Razor syntax, to disable the layout for a specific page we can do this: @{ Layout = null } In Blazor, the convention for it is defined by @layout. However, I cannot see how we can set it as null / disable. I wish to apply it to only the…
waqasahmed
  • 3,198
  • 5
  • 27
  • 50
14
votes
2 answers

Skip JWT Auth during Tests ASP.Net Core 3.1 Web Api

I a have a very simple app with one JWT authenticated controller: [ApiController] [Authorize] [Route("[controller]")] public class JwtController : ControllerBase { public JwtController() { } [HttpGet] public ActionResult Get() =>…
13
votes
3 answers

Is there a robust way to register dependencies in ASP.NET Core 3.1 beside adding everything into Startup class?

I have an ASP.NET Core 3.1 project. Typically, I register any dependency using the ConfigureServices() method in the Startup.cs class. But, I find myself having to register lots of dependencies and the ConfigureServices() looks huge! I know I can…
user12310517
12
votes
4 answers

Error publishing an ASP.NET Core 3.1 site to Azure from Visual Studio 2019

I have a preexisting ASP.NET Core 3.0 application which is successfully deployed to an Azure App Service (using the AspNetCoreModuleV2 module). After upgrading the app to (today's release of) ASP.NET Core 3.1, the application builds and runs…
12
votes
1 answer

Validate authentication cookie with ASP.NET Core 2.1 / 3+ Identity

When using Cookie Authentication in ASP.NET Core 2 (with or without Identity) it might happen, that a user's email or name is changed, or even the account is deleted during the cookie's lifetime. That's why the docs point out, that the cookie should…
11
votes
2 answers

How to modify the current culture date format in Blazor (server)?

ASP.NET Core Blazor globalization and localization states: Blazor's @bind functionality performs formats and parses values for display based on the user's current culture. The current culture can be accessed from the…
IvanH
  • 4,686
  • 13
  • 55
  • 71
10
votes
2 answers

How to add a WCF service reference in a .NET Core 3.1 application?

I'm attempting to add a WCF service reference to a .Net Core 3.1 web API. I'm using Visual Studio 2019 in admin mode. I get the following error: Importing web service metadata ... Number of service endpoints found: 1 Scaffolding service reference…
Bhav
  • 1,466
  • 5
  • 24
  • 48
10
votes
1 answer

.NET Core 3.1 Worker Service - set EnvironmentName on publish

I'm trying to setup a worker service using the asp.net core 3.1 template provided by VS 2019 Enterprise. So far: 1 / Created a new project and ran it: "Hosting Environment: Development", works as expected. Development 2 / Created a FileSystem…
Karuskrokro
  • 103
  • 1
  • 7
10
votes
4 answers

In .NET Core 3.1, the RequestCookieCollection can no longer be used to create cookies in unit tests

I have just upgraded from .NET Core 2.2 to 3.1. I have tests to confirm that extension methods I've added to HttpContext.Request are working. I was previously able to do things like: var context = new DefaultHttpContext(); var c = new…
Dinerdo
  • 410
  • 4
  • 25
10
votes
2 answers

Attribute JsonProperty works incorrect with .NET Core 3.1 when I use underscore symbol

I have the following JSON for patch request: { "idfa": "28A427FE-770B-4FA3-AA8E-123", "idfv": "11B3343C-ECBB-4CC8123B5BA-DDD9CA5768FD", "app_build_number": 1, "app_version": "1.0.0", "screen_height": 820, "screen_width":…
Aleksej_Shherbak
  • 1,608
  • 2
  • 20
  • 39
9
votes
6 answers

Asp.net Core WebAPI Resource based authorization outside controller level

I'm creating a Web API with users having different roles, in addition as any other application I do not want User A to access User B's resources. Like below: Orders/1 (User A) Orders/2 (User B) Of course I can grab the JWT from the request and…
Mozart Al Khateeb
  • 1,536
  • 1
  • 12
  • 26
1
2 3
99 100