Questions tagged [asp.net-core]
ASP.NET Core is an open-source, cross-platform framework for building web applications. Use this tag for questions about ASP.NET Core applications. Use a specific version tag when your question is specific to a particular version of ASP.NET Core.
asp.net-core
117
questions
0
votes
1
answer
21
views
Using Serilog to log at various levels of verbosity across namespaces and classes
I was led to believe that I can set a global minimum level of Information and then in particular namespaces or classes I could bump it up to Debug or even Verbose. This is the code:
using Commons;
...
-1
votes
0
answers
24
views
Setting up a Next.js solution with a Node.js reverse proxy on ASP.NET Core app
We plan to render content with a NextJS with server-side rendering, client-side routing, working, and where the client app and backend are hosted in the same application. The client app is hosted in ...
0
votes
0
answers
14
views
How to resolve 'Application error: An error occurred in the application and your page could not be served' on Heroku?
I created a web app using asp.net core 6 and deployed it using heroku.
My MySQL DB is on aiven.io, and I can connect to it and ran all my migrations from my local to make sure everything is correct. I ...
0
votes
1
answer
73
views
How to loop through Inner list of object
I have a need where I need to loop through sublist of each class.
public Class A
{
public int IdA {get;set;}
public string Name {get;set;}
public List<Class B> Items {get;set;}
}
public Class ...
-1
votes
0
answers
23
views
VS2022 release build - wwwroot folder missing?
create app with template asp.net core web app ( Razor pages )
build in release mode
Does not have wwwroot folder in release directory /bin/release/net8/
Running in VS2022 showing the styling
Deploy it ...
-1
votes
2
answers
60
views
The service collection cannot be modified because it is read-only
I am using ASP.NET Core 8. I'm trying to resolve a dependency at app start up and then use it to manually register a second dependency.
But I am getting this error
The service collection cannot be ...
-1
votes
1
answer
32
views
Efficiently newing up DbContext without dependency injection
I'd like to write a ClaimsPrincipal extension that returns the company associated with a user has the IsLimited flag set.
public static class ClaimsPrincipalExtensions
{
public static bool ...
0
votes
0
answers
25
views
.NET Core ReactJS Deployment in AWS
When I deployed the Angular/React frontend and .NET Core docker backend in AWS EC2 Linux, there is an issue that the frontend can't call the backend using http:localhost:port inside ec2 locally.
Here ...
1
vote
2
answers
25
views
How to mock IConfiguration.GetSection("foo").get<Type>();
I am new to unit testing...
I have a class Settings.cs,
public class Settings
{
public string Format { get; set; }
}
and this is what the appSettings.json contains,
"AppSettings": {
...
1
vote
1
answer
28
views
Blazor .Net Core 8: How to use Server Side Component on the Client side?
I want to use the InteractiveAuto feature of WASM. So I want to create my pages on the client side.
But I also want to access server side components that have access to my SQL database.
It seems ...
-1
votes
0
answers
23
views
How do I get a .NET Core IIS site to select the proper appsettings.json when the environment variable changes?
The problem
IIS, .NET Core, or the site, do not seem to recognize a change to the system environment variable ASPNETCORE_ENVIRONMENT without a hard restart. For example, changing the value of the ...
1
vote
0
answers
20
views
Not Parsing Hindi When Converting HTML to Image in ASP.NET Core Web API
I am generating a card and downloading using api. One can enter a card number and card is generated and downloaded. But the card contains some hindi texts which is not rendering correctly in the ...
0
votes
1
answer
72
views
StringValues.Contains() always returns false
I'm trying to check if an Accept header includes a MIME type like this:
public static bool AcceptsView(this HttpRequest request) => request.Headers.Accept.Contains("text/html");
However ...
0
votes
0
answers
24
views
what layer should mass transit go in n-tier architecutre or clean architecture [closed]
hoping it's a simple question with a clear answer : what layer should mass transit be, one thing to note it's used as background service for now, that could be changed in the future who knows, the app ...
0
votes
0
answers
36
views
ASP.NET CORE Web API does not replace env settings on IIS
I have an API hosted in IIS.
In local testing, with very scenario, it works perfectly. When deployed to IIS, the appsettings.uat1.json did not get loaded and some environment variables are not changed....