318 questions
Best practices
0
votes
2
replies
52
views
c# - How to download large files in .NET application?
We use .NET 8 currently and what I've encountered is a bit annoying and interesting topic at the same time and I would need some advice on how to do it right. Our application can download log files ...
0
votes
0
answers
48
views
EMF/WMF images not rendering on .NET Core + Linux but work on .NET Framework Windows [closed]
I am converting DOCX to PDF using Syncfusion DocIO.
On .NET Framework 4.6 (Windows), all logos render correctly. After migrating the same code to NET Core 8 on Linux, only PNG/JPG images work, while ...
0
votes
1
answer
60
views
HangFire ASP.NET Core 8 MVC the UseMySqlStorage is not working?
I am trying to install and configure the HangFire to make background service in an ASP.NET Core 8 MVC app. I have been installing all packages but when I try to make the configurations it throwns an ...
2
votes
0
answers
85
views
How can I accept a number with a leading 0 in .NET Core?
I'm responsible for maintaining a public ASP.NET Core 8 Web API. One endpoint accepts POST data like this:
{
"xid": 12345,
"message": "Hello, world!"
}
On the ....
1
vote
0
answers
125
views
.NET 8.0 always returns 403
I am developing a website on .NET 8.0. There is no problem in my Visual Studio IIS (I mean, my local development environment), but when I publish my website (to publish my website, I follow this path :...
1
vote
1
answer
116
views
How to cause an unhandled exception in ASP.NET Core 8 server app
There is this old thread about how deal with unhandled exceptions (How can I make something that catches all 'unhandled' exceptions in a WinForms application?)
Now I integrated this in an ASP....
0
votes
0
answers
105
views
Serilog Splunk .NET 8, Splunk stores all messages in one
In my ASP.NET Core 8 web app, I am trying to log the messages to Splunk. Splunk shows all the messages in a single message (nested JSON, very difficult to read messages). I want to store only the ...
1
vote
1
answer
149
views
ASP.NET Core 8 grpc Import "annotations.proto" not found
I have an ASP.NET Core 8 project and followed this article:
https://learn.microsoft.com/en-us/aspnet/core/grpc/json-transcoding-binding?view=aspnetcore-8.0
import "google/api/annotations.proto&...
1
vote
1
answer
300
views
After publishing, Swagger loads but doesn't display any endpoint
During local development, my ASP.NET Core 8 Minimal API project is operating without any issues. Swagger opens at /swagger, all endpoints are visible, and everything is testable directly from the user ...
0
votes
2
answers
709
views
Trouble with ASP.NET Core 8 & Angular project
I'm trying to launch the "Weather Forecast" template solution but encountering an issue I can't resolve.
Here's what I've done:
First, I installed Visual Studio 2022 and Angular 17 (npm ...
0
votes
1
answer
52
views
ASP.NET Core 8.0: CORS, UseStaticFiles and Azure app service
I'm having a weird issue with my CORS configuration. I am hosting an Excel 365 addin that contains formula inside my ASP.NET Core 8 application. To allow the client to download the files, I uses app....
0
votes
1
answer
213
views
ASP.NET Core 8 - Configuration.GetConnectionString() returns null despite appsettings.json setup
I'm working on an ASP.NET Core 8 Web API project using Entity Framework Core. I've added my connection string to appsettings.json, but when I try to retrieve it using
Configuration.GetConnectionString(...
1
vote
0
answers
55
views
Project produces exceptions related to Modals after upgrade
I decided to fork a project and improve it for personal use when after upgrading to .NET 8 from .NET Core 3 I noticed an error message when trying to login or sign up:
BlazoredModal requires a ...
3
votes
1
answer
206
views
.NET 8 not communicating with grpc client
Grpc.Core.RpcException: Status(StatusCode="Internal", Detail="Error starting gRPC call. HttpRequestException: The SSL connection could not be established, see inner exception. ...
1
vote
0
answers
122
views
OnInitializedAsync method is hit again when click submit button of a EditForm
I work with an ASP.NET Core 8.0 Blazor server app and Razor pages. In there I have an OnInitializedAsync method to get data from a SQL Server for changing purposes.
Now in this version this method ...
0
votes
0
answers
74
views
In a SOAP service in C#, the SoapCore library adds an extra root XML node, just before <soap:Envelope>
I created a SOAP service using
ASP.NET Core 8.0
SoapCore 1.2.1.8
The problem: when I get a request and response with an XML structured data, the API adds some root nodes that should be INSIDE the ...
2
votes
2
answers
84
views
Validate all properties are NOT null if one of the properties is not null
I have a record like this:
public record UpdateRequest
{
public int? Prop1 { get; init; }
public int? Prop2 { get; init; }
public int? Prop3 { get; init; }
}
Using Fluent Validation, I ...
0
votes
1
answer
59
views
ASP.NET Core 8 Razor Pages: Handler persists in URL after browser back navigation
I’m working on an ASP.NET Core 8 Razor Pages application where an Edit button on Page A redirects to a function in Page B's backend, which then navigates to Page C. The navigation works as expected.
...
0
votes
0
answers
85
views
ASP.NET Core 8 Web API with BackgroundService and web server both are not starting at the same time
I've an ASP.NET Core 8 Web API project which is successfully running on my local machine, and Swagger UI opens in browser with localhost url.
Here is scenario to update one table data periodically ...
2
votes
1
answer
150
views
NullReferenceException when checking if the Model is null on a Razor Page
I have a situation where I am getting a NullReferenceException when I am checking a model (not a property) to see if it is null. Follow these steps to re-create the issue yourself.
Create a brand new ...
0
votes
0
answers
72
views
Get model metadata using lambda expression in ASP.NET Core Razor Page
Inside a razor page, I must know whether a model property is decorated by [Required].
The conventional answer is:
@{
var isNameRequired =
Context
.RequestServices.GetRequiredService<...
0
votes
2
answers
369
views
How do I set default document for an ASP.NET Core 8 web app in Azure App Services?
First time experimenting with creating an ASP.NET Core 8 web application in Visual Studio Code. I chose .NET 8 because it's the newest version. I am deploying it via Azure App Services. I am very ...
1
vote
0
answers
109
views
C# ASP.NET Core 8 server WebSocket sometimes hangs at ReceiveAsync() when data is available
I have a server application build with ASP.NET Core 8 using the WebSocket middleware.
I use websockets to send messages between a client and the server, in this case it is used to send audio from the ...
0
votes
1
answer
172
views
Invoking IWebHostBuilder.UseStartup<Startup>() in an ASP.NET Core 8 project generates CS0246 (Startup could not be found)
I am trying to make a web application in .NET 8. I am following a Microsoft Learn tutorial for adding Entity Framework Core: https://learn.microsoft.com/en-us/aspnet/core/data/ef-mvc/intro?view=...
0
votes
1
answer
62
views
Azure DevOps Pipeline: changes not reflected after ASP.NET Core 8 MVC deployment to Azure web app
I'm deploying an ASP.NET Core 8 MVC appm, deployed to an Azure web app using Azure DevOps. The pipeline runs without errors, but the latest changes don't show up on the live site, even though the ...
0
votes
1
answer
155
views
Global handle exception .NET 8
I'm working on a fairly standard ASP.NET Core 8 Web API project. I added a module to globally capture exceptions, and it works fine. But now I'm trying to standardize the responses in the controllers ...
1
vote
0
answers
42
views
Issues with Implementing "Remember Me" functionality in ASP.NET Core 8 MVC
I am working on an ASP.NET Core 8 MVC app and trying to implement a "Remember Me" functionality in the login action. However, when I add these lines of code:
var claims = new List<Claim&...
0
votes
1
answer
116
views
Best practice for nested view models in ASP.NET Core 8?
I'm pretty new to web dev and have a question about how to best structure the project in currently working on. The project uses Entity Framework and ASP.NET Core 8 MVC.
In my database I have the ...
0
votes
2
answers
39
views
Form tag helper generating a key-value pair in action
I'm working on upgrading a .NET Framework 4.8 app to .NET Core 8.
Currently experiencing an issue where both Html.BeginForm and the form helper tag sometimes render the wrong action.
In Framework 4.8, ...
1
vote
2
answers
97
views
Blazor doesn't work in a Docker container
I have an ASP.NET Core 8.0 MVC (upgraded from .NET 6.0) project; it's working fine in a Docker container except for the pages that contain Blazor code. I'm getting an error
blazor.server.js:1 [2025-...
0
votes
2
answers
83
views
An operation started on this context before a previous operation completed
I am getting an error while running my ASP.NET Core 8 MVC app.
These are my controller methods hit by Ajax calls by Kendo controls:
public List<Location> GetLocations()
{
return _db....
1
vote
1
answer
82
views
Error 401: "The signature is invalid" al validar JWT en .NET 8
I am developing an API in .NET 8 and implementing authentication using JWT with Microsoft.AspNetCore.Authentication.JwtBearer.
The problem is that when I send the token in the Authorization header as ...
0
votes
1
answer
51
views
Commented javascript libraries in ASP.NET Core _layout.cshtml still getting called?
I deployed a new version of ASP.NET Core 8 web site (file deployment on IIS). Part of the web site uses the jQuery DataTable library and in the new version I used newer version of DataTable and ...
0
votes
1
answer
269
views
After ASP.NET Core 8 Identity SignOutAsync, the user doesn't have to provide credentials to external log in
When using Blazor's IdentityComponentsEndpointRouteBuilderExtensions.cs logout method:
accountGroup.MapPost("/Logout", async (
ClaimsPrincipal user,
...
0
votes
1
answer
316
views
IExceptionHandler in ASP.NET Core 8.0 Web API - how to handle 400 (bad request) and 404 (not found) exceptions?
This is a follow up question to
IExceptionHandler in ASP.NET Core 8.0 Web API - unable to debug
I was advised, that if the request is not sent through IIS (say, sent through SwaggerUI or Postman), ...
0
votes
1
answer
48
views
Identity Model Customization .NET Core 8
I am trying to access the UserRoles property from my ApplicationUser entity and I keep getting an error message stating Invalid column name 'UserId1'. I am following this Microsoft article (https://...
0
votes
1
answer
251
views
ASP.NET Core 8 and Angular Vite Proxy Error: connect ECONNREFUSED 127.0.0.1:40443
I'm working on an ASP.NET Core 8 and Angular project and encountering an error with the Vite proxy setup. I'm trying to proxy requests to my ASP.NET Core API, but I keep getting a connection refused ...
0
votes
2
answers
333
views
C# validation for JSON from request body against a model [duplicate]
I have an ASP.NET Core 8 Web API built with C#, and I'd like to add some validations to the request body for PUT operations. One of it is to ensure that requests coming to my API is matching exactly ...
0
votes
1
answer
59
views
Visual Studio Code caching MVC views
I have an ASP.NET Core 8.0 MVC project and I'm running into a really strange behavior with VS Code. I've been trying to update some routes and my views, and for some reason, it wasn't recognizing my ...
0
votes
0
answers
58
views
Integrate NextAuth in .NET environment
I've developed an application utilizing Next.js for my client side, and an ASP.NET Core 8 Web API for my backend.
The auth flow is fairly simple. My backend issues short-lived access tokens, along ...
0
votes
1
answer
107
views
Pass ModelExpression for use in asp-for tag helper in Razor Pages [duplicate]
I have some repeated code I'd like to move to a Razor Pages code block, which contains an asp-for tag helper. That expects a ModelExpression, and I'm unsure how to pass that.
@model IndexModel
@{
...
0
votes
0
answers
256
views
Microsoft Entity Framework Core [10100]
I have this form and when I try to submit the form, my DB gets a register with null fields, every field that supposed to fill in the form, I sent null, but the fields I've preset the value reaches the ...
0
votes
1
answer
39
views
User not getting redirected to unauthorized page when not authorized
I am redirecting to my .NET 8 application from other application from there I am getting the userid and filling the same in my session. I am adding the userid in claims.
When I am not directly using ...
0
votes
1
answer
59
views
ASP.NET Core 8: error controller method catches the error code, but does not display requested view
I'm using NLog so that when server gets error will direct action to ErrorController.
Program.cs:
app.UseStatusCodePagesWithReExecute("/Error/{0}");
app.UseExceptionHandler("/Error"...
0
votes
1
answer
107
views
FastReport.Data.MsSql 2025.1.16 wants FastReport 2025.1.16 which is not available on Nuget
I'm building for ASP.NET Core 8. Is there something I need to edit to bypass the error message when I include the latest FastReport.Data.MsSql?
When I include the latest version, I get this error:
...
0
votes
1
answer
80
views
Why does my ASP.NET Core Web API need access to the user's home directory?
We have an API that was originally written using the ASP.NET MVC framework and hosted on Windows Server. We have now ported it to an ASP.NET Core 8 Web API, and want to host on Linux (Oracle Linux 9). ...
1
vote
1
answer
56
views
asp-net-route tag doesn't generate the expected link
I'll show you the issue with an example. I created a C# & ASP.NET Core 8 MVC (without HTTPS) sample project with Visual Studio. I added this code to HomeController.cs:
[HttpGet]
[Route("[...
0
votes
1
answer
102
views
ASP.NET Core 8.0 Zero-Downtime Deployment and DLL Lock Issue
I have a question: I am developing with ASP.NET Core 8.0 and have encountered some issues.
In a deployed environment, files like (ProjectName).dll are locked, preventing overwriting. I am curious ...
1
vote
0
answers
405
views
How can Activity.Current.TraceId be the same for multiple requests?
I am currently writing an ASP.NET Core 8 service, and I am seeing strange behaviour (to me) using MVCs Activity.Current.TraceId in my logs.
SO tells me that HttpContext.TraceIdentifier changes per ...
0
votes
1
answer
371
views
Spinning up Angular app with ASP.NET Core Web API on the same port using UseSpa library
I'll appreciate some assistance debugging my code to know what I am missing or doing wrong.
Please feel free to review related code at my git repository at this link https://github.com/slim1477/slim-...