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.
2,802
questions
0
votes
0
answers
14
views
.Net App Stuck in Dev Mode but Config for Release
I have a project built in .Net Core. I'm deploying it to an Ubuntu server running nginx. When I run it locally, everything works. I compile it using the following command:
dotnet publish --...
0
votes
1
answer
38
views
How to add multiple TXT records in Azure DNS record set using .NET SDK
var recordSetParams = new RecordSet();
recordSetParams.TTL = 3600;
recordSetParams.TxtRecords = new List<TxtRecord>();
var strings = new List<...
-2
votes
0
answers
48
views
JSON value of length n is too large and not supported in ASP .NET CORE 3.1
I am getting an exception:
System.ArgumentException: The JSON value of length 495851254 is too
large and not supported. at
System.Text.Json.ThrowHelper.ThrowArgumentException_ValueTooLarge(Int32
...
0
votes
0
answers
38
views
If I have async middleware in ASP.NET Core 6/7 and I am getting 1000 request will there be 1000 threads (created by async) and one main thread? [duplicate]
If I have async middleware in ASP.NET Core 6/7 and I am getting 1000 requests, will there be 1000 threads (created by async) and one main thread?
public async Task InvokeAsync(HttpContext context)
{
...
0
votes
0
answers
15
views
Azure job is aborting after some
I have two triggered webjobs created in ASP.Net core, CORN time set in appsettings.json . we have paid suscription.
Run every 5mins - "CRONTIME": "0 */5 * * * *",
Run every day - &...
0
votes
0
answers
26
views
.NET Core 3.1 IdentityRole violates the constraint of Trole
I have a .NET Core 3.1 app using Microsoft Identity. If I configure services in startup.cs using .AddIdentityCore<User>(), everything works fine.
If I try to add support for roles, either by ...
1
vote
0
answers
31
views
How Can i add multiple event bus for rabbitMQ
startup.cs
services.AddSingleton<IRabbitMQPersistentConnection>(sp =>
{
var logger =
sp.GetRequiredService<ILogger<DefaultRabbitMQPersistentConnection>>
();
...
0
votes
1
answer
44
views
Sql Server Creates Temp Tables Itself [closed]
My sql server creates temp tables itself. I have no code includes create table. Also i don't know how it happen but somehow this user constantly run this sql command:
1
vote
1
answer
102
views
.NET Core 3.1 incoming request timeout not working
I have a .NET Core 3.1 Web API that I want to control how long it will wait until returning a 504 timeout error.
I added the following code to Program.cs:
public static void Main(string[] args) => ...
0
votes
0
answers
13
views
Authorize an action to Admin and only the user who created and event in dotnet core [duplicate]
I need to authorize the edit action method for admin or only the users who created it.
I am adding these policy
services.AddAuthorization(options =>
{
options.AddPolicy("EditAnyEventPolicy&...
0
votes
0
answers
76
views
An unhandled exception occurred while processing the request. ArgumentException: Keyword not supported: 'trust server certificate'
I have deploy a ASP.Net Core MVC Web Application in IIS using web deploy, certain page like Homepage, About us is working fine, but page like a listing page which will getting data from sql database ...
4
votes
1
answer
251
views
SSL Authentication Error after upgrading to .NET 6 when connecting to MySQL database with TLS 1.1
I have a MySQL database with version 5.7.19 and TLS version 1.1. I'm using the following code snippet to establish a connection in my .NET Core 3.1 application:
string connStr = "server=Myserver;...
0
votes
0
answers
63
views
ASP.NET web app doesn't run correctly after upgrade from ASP.NET Core 3.1 to ASP.NET Core 6
I just updated my ASP.NET Core 3.1 web app to .NET 6. It builds fine locally but I had all kinds of issues publishing to our IIS server. I usually publish using the dotnet CLI on our IIS server.
When ...
2
votes
1
answer
75
views
Custom Authorization ASP.NET Core
I want to create a simple authorization handler that redirects the user to a specific page when requirement is not fulfilled like so:
protected override Task HandleRequirementAsync(...
2
votes
2
answers
150
views
Background Service in .net core 3 that will wait for jobs to be processed from JobQueue table in the Database
We have to expose a Web API with methods that will perform bulk operations like insert , update and delete, now for example the client will send a request to Create method in the API and they can send ...
0
votes
1
answer
99
views
dynamic option value not updating using IOptionsMonitor
Question: I have a case where I need to save user token in the WebConfig section of appsettings.json using IOptionsMonitor.
e.g. When a user made a request to the app, request middleware will make ...
0
votes
0
answers
25
views
ABCPdf unable to find type or namespace PDFTable
I am using ABCPdf to insert Table of contents on the first page in my .NET Core 3.1 project. Compiler is unable to find PDFTable class as mentioned here in documentation.
Sample code below:
using ...
0
votes
1
answer
42
views
How to get cookie renewal information in .NET Core 3.1 with CookieAuthentication?
I am using .NET Core 3.1 and would like to know how to get cookie renewal information when a user's login cookie expire time is extended.
I have tried adding the following code to startup.cs, but ...
-1
votes
1
answer
51
views
How can I fix the `TryRefreshAsync not found` error?
As part of a migration of my project from the .NET Core to .NET 6 I upgraded the Microsoft.Extensions.Configuration.AzureAppConfiguration from the 4.5.0 to the 6.0.0.
After that with any of my request ...
0
votes
0
answers
22
views
User.Identity.IsAuthenticated is always false in .net core 3.1
I am trying to implement single sign on across subdomains using forms authentication and .net Core 3.1. I have a website called parent.com where user logs in and I want to make sure that when user ...
0
votes
1
answer
47
views
How to get the User.Identity information in the Middleware during the /connect/authorize call when the user still has authentication cookies?
I have a problem with my Middleware that the user identity is always empty because the user can access the page with their authentification cookies.
This middleware is to check and do the redirection ...
0
votes
1
answer
165
views
Remove null items from json array properties before model validation in ASP.NET Core 3 Web API
I am trying to remove null items of json array properties from the users posted payload. My model properties are well annotated wherever validation is required like Required Attribute an so on.
My API ...
0
votes
0
answers
13
views
Validate security stamp for cookies
I want to validate security stamp for cookies in each request but when I use this piece of code it make infinite redirect
services.Configure<SecurityStampValidatorOptions>(options =>
...
0
votes
1
answer
74
views
EF migration error while publishing .NET Core 3.1 app
I am trying to publish my ASP.NET Core 3.1 Web API on Azure, but I am getting errors on EF migrations:
When I run the below command in console:
dotnet tool install dotnet-ef --version 3.1.32
I get ...
0
votes
0
answers
43
views
Prevent user to access the application with cookie after sign out
In my .net core 3.1 App there is a Scenario when login with user then take cookies from local storage after that logged out. then try to access API with this cookie using postman it can access the API ...
0
votes
1
answer
225
views
Integration of an application with keycloak for SSO using open id connect
I have an application which developed few years back using .netcore 3.1. Now want to implement the SSO using keycloak with open id connect. Currently, when I run the app it can direct to keycloak sign ...
1
vote
1
answer
91
views
mvc. net core radio buttons to select value for each and model binder
I have 4 radio buttons, and I want to select value for each radio buttons and bind them to a model binder so that each property will have a value either true or false. At the moment, we need radio ...
1
vote
1
answer
232
views
How to call ASP.NET Core Web APIs from ASP.NET Webform using HttpClient?
I have 2 different project. I created web apis project in ASP.NET CORE 3.1 (MVC). Another I created ASP.NET webforms website (.NET Framework 4.8). I am unbale to call .NET Core web apis from webforms ...
0
votes
0
answers
78
views
How can I publish my web app with new connection strings?
I'm using net core 3.1 with a Visual Basic Project and publishing to a folder that IIS uses for the website. We have recently moved our SQL database to a new server and I can't update the connection ...
1
vote
1
answer
133
views
Modify API response before passing back to controller in .NET Core
I'm able to achieve same behavior easily in .NET Framework but coming to .NET Core I don't find needed methods to achieve same
Snippet: below response has only Getter no setter and CreateErrorResponse ...
0
votes
0
answers
40
views
Add Web Reference in .Net Core 3.1
I'm upgrading my project from .Net Core 1.1 to .Net Core 3.1. I'm having Web references in my older version, now I want to use the same Web reference in .Net Core 3.1 project, but the problem is I ...
0
votes
0
answers
42
views
Misused header name. Make sure request headers are used with HttpRequestMessage, response headers with HttpResponseMessage,
My application is in C# and asp.net core 3.1.
I am trying to call an API that requires me to indicate the Content-type header but when I add it I get the above error message. Here is my code
string ...
0
votes
1
answer
431
views
Docker Image - microsoft-dotnet-aspnet and microsoft-dotnet-runtime not found
Any one have any news regarding those two images?
https://hub.docker.com/_/microsoft-dotnet-aspnet
https://hub.docker.com/_/microsoft-dotnet-runtime
Our services stopped working after redeploying, and ...
1
vote
0
answers
52
views
ASP.NET Core asp-for input tag helper setting zero value
I have an ASP.NET Core 3.1 MVC web application. I'm passing a model to a partial view that I'm showing in a modal window (via ajax call). There is a lot of code (.cshtml, controller, model) so let me ...
0
votes
0
answers
24
views
Has anyone faced an issue where SecurityStampValidatorOptions causes login to fail for the sql database?
I am using .net core 3.1 and my mvc application was working fine. The need arose for me to add
services.Configure<SecurityStampValidatorOptions>(options =>
{
...
0
votes
0
answers
20
views
How to improve performance of Angular and .NET core application rendering mailbox
We are using angular as frontend app and .NET core app as backend app.
Backend app fetches user mail boxes and emails from Microsoft graph API, then angular app renders mail box for user. UI is same ...
1
vote
1
answer
78
views
How to ignore ActionParameters in the Audit Trail data
I have implemented Audit Trail in asp.net core 3.1 application using great library which has a very good documentation also : https://github.com/thepirat000/Audit.NET/blob/master/src/Audit.WebApi/...
0
votes
0
answers
209
views
How to extend LazyCache with Redis Cache for asp.net core 3.1 application?
I have asp.net core 3.1 web api project which leverages Azure SQL database as its data storage option. At present I am also using Azure Redis Cache to improve performance of the application.
Here goes ...
0
votes
0
answers
81
views
Azure CI pipeline not putting Razor Class Library static web assets into the correct folder
I'm trying to build a NuGet package that will contain a lot of boilerplate code for an Asp.Net Core web app. As part of this I need to have access to some static web assets (.js, .css files...). When ...
0
votes
0
answers
90
views
ODATA Pagination, Filter and OrderBy taking more time with Multiple result sets
I'm using .NetCore 3.1, ODATA and EF Core. I've Customer and Transaction tables. Tenant will have multiple customers and Customers will have multiple Transactions.
Below is my ODATA API looks like
[...
1
vote
2
answers
167
views
Replace the injected HttpContext for class in application
I'm setting up some integration tests for mediatr handlers using xunit, respawn, and webapplicationfactory....
One of classes ultimately called by the mediatr handler that is being tested.. has a ...
0
votes
1
answer
54
views
Not able to Copy wwwroot/lib/jQuery/bower.json and some other json, js and css files
I am trying to containerize Asp.Net Core 3.1 MVC application. Docker file is working fine locally but when trying to build image through step in Azure Pipeline it is throwing error
/usr/share/dotnet/...
0
votes
0
answers
33
views
How to make it work different platform of ibm db2 core library?
IBM has created two separate NuGet packages for the DB2 core (for Windows and Linux), leading to an architectural issue. This issue has arisen because my hosting environment is on Linux, while my ...
0
votes
1
answer
76
views
A second operation started on this context before a previous operation completed. This is usually caused by different threads using the same thread
I have an ASP.NET Core 3.1 Web API project with Microsoft.EntityFrameworkCore version 2.2.6 and Azure SQL as the data source for the application.
I have the following code for setting up the DbContext ...
0
votes
1
answer
85
views
When deploy Azure function to Azure how did it know that it should read the AzureFunctionSettings from App settings instead of from local.setting.json
I created my first Azure Function which integrate with SharePoint Online list, using those main points:-
1-I created an Azure App with self-sign certificate to authorize my Azure function.
2-I ...
0
votes
0
answers
38
views
Can I replace Razor page generation with custom without redirection in Middleware?
I'm trying to stop the requested routes' Razor page response generation globally under certain conditions, and replace it with something else.
Using the following middleware I'm able to rewrite the ...
-1
votes
1
answer
96
views
How to force all URLs to lowercase in ASP.NET Core 2.2 and newer version?
I want to convert all URLs to lowercase.
For example:
https://ABC123.com/ -> https://abc123.com/
https://StackoverFlow.com/ -> https://stackoverflow.com/
Thanks in advance
0
votes
0
answers
98
views
How to publish multiple projects in ASP.NET Core 3.1
I have a question. I created a web application using ASP.NET Core 3.1 in Visual Studio 2022. In the solution, I have three projects, the first is my main project, the second is the admin panel and the ...
0
votes
1
answer
241
views
Unable to resolve service for type 'Microsoft.Extensions.FileProviders.IFileProvider' while attempting to activate my controller
I have this in my controller
using Microsoft.Extensions.FileProviders;
[ApiController]
[Route("api/[controller]")]
public class PlanningController: ControllerBase
{
private readonly ...
0
votes
1
answer
125
views
Convert ASP.NET MVC MvcRouteHandler to ASP.NET Core MVC
I have to port over the following ASP.NET MVC code to .NET Core and I'm stuck on how to do this.
This is my old ASP.NET MVC code:
public class RouteConfig
{
public static void RegisterRoutes(...