40 questions
Best practices
0
votes
1
replies
44
views
How should shared DTOs be managed across API, Application, and Frontend layers in a .NET 9 Clean Architecture project?
I’m working on a .NET 9 Clean Architecture solution with the following structure:
API – ASP.NET Core Web API (.NET 9)
Application – Application services and business logic
Domain – Core domain ...
-3
votes
1
answer
80
views
.Net Core 9 DI for dynamic instance creation and its required services [closed]
I have the following 2 classes. MyClass composes MyOtherClasses. Each of them requires different ILogger<foo>:
public class MyClass
{
private readonly ILogger<MyClass> _logger;
...
0
votes
0
answers
479
views
GetSwagger does not have an implementation
I am getting the following error in the startup of my ASP.NET Core 9 Web API project:
System.TypeLoadException: 'Method 'GetSwagger' in type 'Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator' from ...
1
vote
0
answers
136
views
Microsoft Graph API $search fails with "Syntax error: character ':' is not valid" for KQL queries
I'm using the Microsoft.Graph SDK (v5.92.0) in an ASP.NET Core 9 application to search a user's messages.
A simple search with a single term works correctly, but when I use a KQL-formatted string as ...
1
vote
1
answer
80
views
Conditionally handle multiple ValidationMessages with a ValidateComplexType model in an EditForm
In a Blazor web app, I needed to conditionally handle multiple <ValidationMessages> because they're not bound to a single function.
At the moment, I have two instances of <ValidationMessages&...
0
votes
1
answer
94
views
How can I render the plaintext first before the image in Blazor?
Originally, the plaintext and images were defined in a single data model class, but the issue is that it fetches everything before it renders on the client-side.
Therefore, I decided to separate the ...
0
votes
0
answers
115
views
Multiple ways for authentication in ASP.NET Core 9.0 Blazor
I want to write a Blazor app that uses the IP address to decide between the OpenId Connect authentication method, and Windows authentication with Active Directory.
I need Windows authentication for ...
0
votes
1
answer
94
views
Is it possible to use @rendermode="InteractiveAuto" in a .NET 9 Blazor Web App using a single .net project?
I would like to create a Blazor Web App that first renders components using SSR until the Wasm components can be downloaded then future requests should render the Wasm component.
My application seems ...
0
votes
0
answers
54
views
Blazor 9.0 Two-Way Databinding not working with Custom Component
I am wrapping a TelerikDialog component to create a specifically purposed dialog box.
CustomDialog.razor
<TelerikDialog @bind-Visible="@this.IsVisible">
<DialogTitle>
...
0
votes
2
answers
89
views
Check JWT accessToken issued by another service
I have a micro service app (React + .NET 9) with 2 backend services:
Auth service which login user and issue JWT with username + role (on port 8005)
Main service which receive this token and based on ...
1
vote
0
answers
24
views
Data annotation date validation failed when using Safari in ASP.NET Core 9
I have this field, EXP_DEL_DATE, which is defined in a class as follows :
[BindProperty]
[Required(ErrorMessageResourceType = typeof(MsgsResource), ErrorMessageResourceName = MandatoryFld)]
[...
1
vote
0
answers
59
views
ASP.NET Core 9.0 Aspire change endpoints
I've created a standard ASP.NET Core 9 Aspire application with all projects.
All work fine till I use localhost as endpoint for my web app, but obviously, I want to change to local lan IP (192.168.0.2 ...
0
votes
1
answer
163
views
ASP.NET Core minimal API route containing URL does not work behind IIS
I am writing ASP.NET Core 9 application using the minimal API. In this application I have a route that accepts an absolute URL as part of the route. This works when I run the ASP.NET application ...
0
votes
1
answer
124
views
Blazor Server JS Interop Not Triggering in OnAfterRenderAsync Despite JS Loaded and Working in Console
I'm working on a Blazor Server on .NET 9.0 application and trying to integrate basic JavaScript interop before adding external libraries like Algolia InstantSearch.
This is my current code setup - ...
1
vote
1
answer
186
views
Not able to build Static Assets and Manifest in .NET 9
I have a .NET 9 web app with Razor Pages and Parcel to build the client application.
I ran the command dotnet publish -c Release and the following happened:
the client app (in approot) was built and ...
1
vote
2
answers
490
views
Minimal API endpoint not appearing in OpenAPI using custom MapGet extension
I'm working on a project using the Clean Architecture Template.
I'm trying to configure the Endpoints with OpenApi specifications.
Here's what I tried to implement:
Custom MapGet Extension
public ...
1
vote
1
answer
79
views
How to reduce database full-scans when paginating vector search results (ASP.NET Core, PGVector)?
Current Behavior
I am using pgvector with ASP.NET Core 9.0 to personalize user experience based on their preferences.
I have a posts controller that returns posts (paginated using cursor pagination) ...
1
vote
0
answers
281
views
ASP.NET Core 9 OpenApi MaxDepth exception
I just upgraded to .NET 9 and I get the following error when I visit the /openapi/v1.json endpoint:
[15:28:03 ERR] An unhandled exception has occurred while executing the request.
System.Text.Json....
0
votes
1
answer
81
views
How to dockerize ASP.NET Core 9 application with Angular?
I recently created an ASP.BET Core 9 application with Angular and try to dockerize it. It builds successfully, but it does not launch the angular app.
This is how I created my project:
mkdir <...
0
votes
0
answers
265
views
Error message from IIS 10.0 The WebRootPath was not found
I am receiving the following message in my log file:
'The WebRootPath was not found: C:\inetpub\CondoWebSite\condo11. Static files may be unavailable.' when I try to start my website.
Using IIS10 on ...
0
votes
0
answers
131
views
Data Protection in ASP.NET Core 9 works on Windows 11, fails on Windows Server
I have an ASP.NET Core application running under IIS where I configure data protection using this code:
var dataProtectionEncryptionCertificate = X509CertificateLoader.LoadPkcs12FromFile(path, ...
0
votes
0
answers
66
views
Stack Overflow Exception in .NET System.Private.CoreLib.DLL
I have an ASP.NET Core 9 application running as a service. After the latest upgrades of nuget packages, the application crashes periodically with a StackOverflow exception:
I tried to reproduce it, ...
0
votes
0
answers
79
views
C# ASP.NET Core 9 MVC: invalid ModelState on list properties when posting my ActionResult
I am trying to create a registration form (view). Whenever I do a HTTP POST with my model, I get an "Invalid ModelState" error on the 2 lists that I have in my view model. All properties are ...
0
votes
2
answers
108
views
Blazor not generating matching scoped CSS selector in html markup of compiled razor page
My Blazor build (ASP.NET Core 9.0, VS 2022) is correctly generating the scoped selectors for isolated CSS:
Program.cs:
builder.WebHost.UseStaticWebAssets();
App.razor <head> tag:
<link rel=&...
0
votes
2
answers
243
views
ASP.NET Core 9 Blazor doesn't serve static folders
I add a folder to wwwroot in Visual Studio 2022 and Blazor .NET 9.
My project is blazor server side, but after debug, this folder doesn't get served. I can't use fonts in the CSS.
This my CSS :
@font-...
1
vote
1
answer
73
views
Why can't I register a hub filter in my SignalR application?
I'm building a .NET 9 application that uses SignalR for realtime messaging. I want to validate incoming requests using a Filter. The following documentation indicates that I should do so by adding the ...
0
votes
0
answers
196
views
.NET 9 Seems to ignore Directory.Build.props (or Directory.Build.targets or D.Packages.props)
Seems like there is no possible way to enforce/overwrite a package version (or transitive package version).
My project is hosted in Azure app service with .NET 8 and props file in the root to enforce ...
0
votes
0
answers
193
views
API Swagger URL is not loading at all through .NET aspire 9.0
I've added Aspire 9.0 project to spin API swagger and SQL Server container.
I'm able to spin SQL Server container, but not API Swagger URL.
I've added project references of both API and database ...
0
votes
0
answers
94
views
How to write multi line entry to Linux log
My ASP.NET Core 9 MVC application runs as a service in Debian and logs into a journal.
Program.cs:
using Microsoft.Extensions.Hosting.Systemd;
var builder = WebApplication.CreateBuilder(args);
// ...
2
votes
0
answers
138
views
Can't Connect to Docker Container Backend (ASP.NET Core 9) running locally
I'm building a React front end and ASP.NET Core 9 backend webapp.
In debugging mode, it works fine, however, when I create Docker containers and run it locally, the front end just won't talk to the ...
0
votes
1
answer
64
views
How to write message with warning priority to Debian journal
I have an ASP.NET Core 9 application controller that logs messages with warning level in Debian 12:
public class ContextLessLogger(ILogger syslog)
{
public Log()
{
syslog.Log(LogLevel....
1
vote
1
answer
171
views
Why does my ASP.NET Core 9 app throw a bunch of (seemingly harmless) exceptions to the Visual Studio ouput panel?
I'm using Sqlite in my ASP.NET Core 9.0 app. Whenever I debug in Visual Studio, I get hundreds of these errors in the output panel:
15:43:08:084 Exception thrown: 'Microsoft.Data.Sqlite....
0
votes
2
answers
224
views
Blazor 9 WASM Logout throws AntiforgeryValidationException
I created a straight-from-the-template Blazor 9 WASM Web App with Authentication type set to Individual Accounts, and Global Webassembly interaction.
The only change I made was to swap in Microsoft....
-1
votes
1
answer
50
views
IIS shows error with generated web.config
publishing my web.app (build with dotnet core wasm standalone - SPA) generates a web.config, that looks good, but IIS cannot open it.
f.e. when i click on MIME it shows:
The same on other Settings. ...
1
vote
1
answer
124
views
How to read journal in Linux
ASP.NET Core 9 MVC controller reads Debian 12 journal using:
public async Task<IActionResult> Syslog(string param = "-r -u eevatest.service --since \"2 days ago\""
)
{...
1
vote
1
answer
300
views
ASP.NET Core 9 hangs in docker container while running sub-processes
I have an ASP.NET Core 9 application running in a linux docker container.
Made using this dockerfile:
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
WORKDIR /app
# Install base components
RUN apt ...
0
votes
1
answer
174
views
C# IMemoryCache: append to list in one operation?
I'm using an IMemoryCache (Microsoft.Extensions.Caching.Memory) in a ASP.NET Core 9 project. I'm storing a List<string> in that cache, and would like to add a value to that list.
This seems to ...
1
vote
1
answer
667
views
Large file upload/download to Azure Container App using memory
Background
I'm working with an ASP.NET Core 9 Web API that takes a (potentially large) file upload from one of our client apps, streams it to a temporary file on the server, does some processing, and ...
-1
votes
3
answers
254
views
Why an error occurred after connection was established successfully in an ASP.NET Core 9 Web API?
I have an ASP.NET Core 9 Web API project with SQL Server 2019, and the connection string is defined in the appsettings.json as shown below:
"AllowedHosts": "*",
"...
3
votes
1
answer
642
views
How to distinguish empty/null/unset array property in appsettings.json?
I am using Microsoft.Extensions.Configuration in ASP.NET Core 9.0 to access configurations from the appsettings.json file:
public class MySettings
{
public int? Foo { get; set; }
public string[...