15,251 questions
0
votes
1
answer
73
views
Performance and thread‑safety ASP.NET Core MVC [closed]
I’ve been working as a .NET C# developer for a little over two years in a software company. For almost a year now, I’ve been leading (as team leader/PM) a project that actually started before I joined....
0
votes
1
answer
29
views
Quartz jobs not firing after IIS app pool recycle in ASP.NET Core MVC even with AlwaysRunning and preload enabled
I have an ASP.NET Core MVC project that uses Quartz.NET to run background jobs.
Problem: I have configured the IIS application pool for this app with:
StartMode = AlwaysRunning
Idle Timeout = 0 (...
-3
votes
0
answers
51
views
Can't implement .NET Blazor identity [closed]
When I try to create a scaffolded item for my identity, I get this error:
This is what I did to create my Blazor identity:
Currently, my Data folder only has a file called FoundBoxContext.cs:
Does ...
0
votes
0
answers
37
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 ...
0
votes
0
answers
66
views
Required data annotations returning namespace rather than error message value?
I have an ASP.NET Core 8 MVC application, using the bog standard [Required] attribute on a class property. I expected to see the defined error message in my HTML, in the data-val-required attribute on ...
0
votes
1
answer
50
views
ASP.NET Core site can't find Default route on startup
I add a route named default with the pattern
{controller=Assets}/{action=Index}/{id?}
but I get an http 404 "Not Found" error.
If I type in /Assets in the browser, it finds the view, it's ...
1
vote
1
answer
64
views
asp-for is not generating name or id for input form
I'm creating a basic ASP.NET Core MVC project. I already created the API project and I was able to login just fine with Swagger. So, now I want to create the web app project for the login page.
Here's ...
0
votes
0
answers
57
views
ASP.NET Core 8 Code Generator error: "Minimal hosting scenario! InvalidOperationException"
I'm working on an ASP.NET Core 8 MVC project with a layered architecture:
Main project: FarazFactoryManagement (contains Program.cs)
Data layer: DataLayer (contains my AppDbContext and model classes)
...
0
votes
2
answers
135
views
Custom error message for failed model binding with FluentValidation
I’m building an ASP.NET Core MVC application with a view model that contains a nullable enum, decimal and other int properties.
Example:
public class UserViewModel
{
public decimal? Amount { get; ...
0
votes
0
answers
37
views
JSON output doesn't add the new line on my model file in ASP.NET Core MVC
I'm going to get straight to the point: my model file Vanexo3_h was missing the parameter puertoembarque, so I decided to added so I can print that in a PDF viewer on my system. The problem is that ...
0
votes
1
answer
69
views
asp-area in forms generating a wrong route
I have a problem in ASP.NET Core 5. When I use asp-area for example like this:
<form asp-area="Admin" asp-controller="User" asp-action="Register">your text
the ...
3
votes
2
answers
123
views
Error when accessing data, EF Core seems to create its own column
I have a project that has uses a database-first approach. I have used db-scaffold to create the models and have also created 'custom' models to contain extra info and code.
I have a model class ...
-1
votes
1
answer
106
views
InvalidCastException: Unable to cast object of type 'System.String' to type 'System.Int32'. ASP.NET Core [closed]
How to fix this issue? When I run my code, from my home page, then when I go to suppliers page, the following error shows up:
InvalidCastException: Unable to cast object of type 'System.String' to ...
1
vote
0
answers
121
views
NLog does not archive the file
In my WCF / C# project, I am using Nlog, it successfully creates logs inside the current date folder, but it does not archive the log files.
NLog.config:
<nlog xmlns="http://www.nlog-project....
0
votes
0
answers
182
views
ASP.NET Core MVC how to enable a report to be viewed
I have two projects Research and ResearchReports in a solution called Research. The Research project is fully functional and I now need to look into the reporting aspect.
I followed How to add a ...
1
vote
1
answer
156
views
Prevent trace exports for the Metrics endpoint with OpenTelemetry
I have this easy setup in my ASP.NET Core web app:
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions....
1
vote
0
answers
124
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 :...
0
votes
2
answers
86
views
FluentValidation with ASP.NET Core MVC: DTOs without data annotations still trigger default "is required" messages
I have an ASP.NET Core 9.0 MVC project where I use DTOs for input binding and FluentValidation 12.x for validation.
Entities exist separately and contain data annotations attributes like [Required] ...
0
votes
2
answers
100
views
How do I resolve, "Error NETSDK1022: Duplicate 'Content' items were included" error message?
I am attempting to migrate an ASP.NET Core 3.1 MVC project in Visual Studio 2022 to ASP.NET Core 6.0. The project builds and runs flawlessly on my development server but fails when uploaded to be ...
0
votes
0
answers
83
views
Define execution hand-off point in .NET Core [duplicate]
I'm developing a simple web app that will (roughly) do the following:
Receive request to do something
Send back an acknowledgement response
Call the function that does the thing (the "execution ...
0
votes
0
answers
33
views
How to remove 'unsafe-eval' from CSP in legacy ASP.NET Core 3.1 MVC + Angular 12 project using MVC and JIT compilation?
I have a legacy project developed with ASP.NET Core 3.1 MVC and Angular 12 (originally it was Angular 5).
I need to set a Content Security Policy (CSP) for the website without using 'unsafe-val' to ...
1
vote
1
answer
63
views
ASP.NET Core MVC: have button on Details view take you to another model's Create view and have the primary key value copied into field
I have a Details view (PIF model) that contains views of several models at the bottom. Screenshot shows the Internal Comments model data underneath the last row of PIF model data.
The PIF model has a ...
-1
votes
1
answer
66
views
ASP.NET Core MVC : where in the controller to put the calculation of day difference, and how to then show in Index View [closed]
I need to be able to calculate the number of business days difference between two dates: from DateRequestMade to DateIssued. I have used this code that I found:
var calculatedBusinessDays =
1 + ((...
1
vote
1
answer
70
views
ASP.NET Core MVC Edit GET works but POST results in ArgumentNullException: Value cannot be null. (Parameter 'items') despite debugging showing data
I'm sure this is something really obvious but I've spent hours (including a lot of Googling) on this and I am stuck.
I am able to create a record (along with the Fluent Validations firing where need ...
2
votes
1
answer
67
views
Fluent Validation working in Create but not Edit
Both Create and Edit views use the same validations controller. Create works correctly, showing error messages, and saves upon correcting any validation issues, taking you to the Index view.
For the ...
0
votes
1
answer
41
views
Script debugging and Entra ID (B2C) can't both be on at the same time
I have a Visual Studio ASP.NET Core MVC app with lots of Javascript / TypeScript that I need to debug. Up to now, I have been successfully using the Script Debugging feature.
I have now incorporated ...
2
votes
2
answers
119
views
How can I adjust the scope of isolated CSS is ASP.NET Core MVC such that it applies to all elements on the page
I'm a little new to ASP.NET Core, so sorry for the beginner question. I created a new ASP.NET Core MVC project and was able to build and view the template. Great.
Next, I wanted to try something ...
0
votes
1
answer
89
views
404 not found js css assets with ASP.NET Core MVC, vite/vue web app
I'm having trouble with an ASP.NET Core 8 MVC app with vite vue. My app runs locally in which I mound in a cshtml div id= app all the vue components.
Locally the vite server runs and everything is ...
2
votes
2
answers
113
views
ASP.NET Core MVC RedirectToAction with error id code to show a message box
Currently in my controller, after the Create call, it takes me back to my Index.cshtml page - this is working fine.
What I want it to do is also take an id with it the indicate failure in the Create ...
0
votes
0
answers
67
views
ASP.NET Core MVC Identity is not confirming email account addresses on registration
I have an ASP.NET Core MVC website that uses individual accounts with the Microsoft Identity provider. I used the Visual Studio scaffold option to add the Identity user accounts to my project, but I ...
0
votes
0
answers
70
views
Why does an ASP.NET Core 8.0 MVC project not load scripts from wwwroot while debugging in IISExpress?
I have an ASP.NET Core 8.0 MVC with controllers and API controllers. It has Razor pages which are loaded using MVC controllers. Pages then communicate with the portal using AJAX and a Web API.
...
1
vote
1
answer
51
views
ASP.NET Core MVC: How to make simple page with IEnumerable<XML>
I have a simple project where the start page shows a list of books. How to make the same page, but with display as XML?
Controller method:
public IActionResult Index()
{
// stored procedure
...
-1
votes
2
answers
168
views
ASP.NET Core Web API [NULL vs UNDEFINED]
In my HTTP controller using model binding, how can I determine if a request model property, is NULL because it was explicitly set to NULL by the API client, or is NULL because it was missing in the ...
0
votes
0
answers
57
views
Unable to set json as language in monaco editor
In my ASP.NET Core MVC view, I have the following code:
<script type="module">
import * as monaco from 'https://cdn.jsdelivr.net/npm/monaco-editor@latest/+esm';
document....
0
votes
1
answer
87
views
What are Areas for in ASP.NET Core? [closed]
What are areas in ASP.NET Core projects? I've been developing an application using the modular monolith design and a few example applications I saw used areas along with the MapDynamicControllerRoute()...
0
votes
3
answers
67
views
dropdown menu item doesn't drop down
I have an ASP.NET Core MVC web application. In _layout.cshtml, I have the following code, but it doesn't drop down in the menu bar it shows "manage" with a down arrow next to it below is the ...
0
votes
0
answers
37
views
Binding list of objects with dynamic form
Here's my current structure. Using a Pet example cause it's easier than explaining my domain.
Controller:
Manage endpoint
GetForm endpoint
Create endpoint (HTTP POST)
View:
Manage has the <form ...
0
votes
1
answer
46
views
How can I overwrite one item in an array in the appsettings stack when the item is moderately complex? [closed]
I have an ASP.NET Core MVC app using Serilog. Sinks are configured in the appsettings.json. I have a few sinks.
One of the sinks is not behaving. Typically I would overwrite the values of the ...
0
votes
1
answer
85
views
How to send model and some other parameters from javascript to controller using jquery.ajax?
I have an ASP.NET Core MVC project and I am trying to send a model and some other parameter from JavaScript to a controller action. First I fill the model from view fields whose names match the model ...
0
votes
1
answer
76
views
EF Core in-memory unit test fails
I am trying to unit test the Delete[Async] method in my repository.
The Delete method uses the "create - and - attach approach" rather then the "read-first approach" which would be ...
2
votes
1
answer
102
views
EF Core CLI: "Unable to create a 'DbContext' of type ''" error when running migration from multi-project solution
I'm working on an ASP.NET Core MVC application with a layered architecture (domain, infrastructure, web). I'm trying to run EF Core migrations from the GemsIrisDiMvc.Infrastructure project while using ...
0
votes
2
answers
151
views
Visual Studio - ASP.NET Core MVC / C# docker container app can't connect to the browser with 100% out of the box scaffolded code
I created an app with Visual Studio. Everything I did was an out-of-the-box selection. I picked ASP.NET Core Web App (Model-View-Controller) > Framework: .NET 8.0 (Long Term Support), ✔️Enable ...
0
votes
1
answer
107
views
After updating ASP.NET Core MVC from .NET 6 to .NET 8, the project property throws error
Recently, I have updated my ASP.NET Core MVC application from .NET 6 to .NET 8. The VS 2022 Professional was also updated to version 17.14.7.
After that, when I right-click my web project, which is ...
2
votes
2
answers
99
views
Ajax POST returns undefined from ASP.NET Core Web API with no errors
In my ASP.NET Core MVC web app project, I'm sending a POST request to an external API using HttpClient. Everything seems to be working correctly, but on the JavaScript side, the response is undefined. ...
0
votes
0
answers
182
views
ASP.NET Core 8.0 Microsoft authentication error - AuthenticationFailureException: the oauth state was missing or invalid
My setup:
ASP.NET Core 8 MVC application, configured to act purely as an API (returns JSON, no traditional views)
Frontend: React application running on http://localhost:3000
Backend API: running on ...
1
vote
2
answers
73
views
ASP.NET Core MVC with Razor - how can I repopulate a view with new model data?
The use case is this: the user can enter a client number and I can then do an API call and get all their information and repopulate the form.
The form is say at /Users/Add.
I don't want just reload ...
2
votes
1
answer
55
views
IAsyncActionFilter using a custom log implementation
In my ASP.NET Core project, I want to verify if a call to the APIs has a valid token in the header. For that, I created a new Attribute like that:
[AttributeUsage(validOn: AttributeTargets.Class | ...
0
votes
0
answers
88
views
ASP.NET Core 8 MVC app in IIS fails to start – still trying to open one file
I'm trying to host an ASP.NET Core 8 MVC application on IIS (Windows 10), but the application fails to start. The browser just hangs, and in the Event Viewer I noticed it's trying to open a file, ...
0
votes
1
answer
68
views
How to improve object judgment accuracy in ASP.NET Core with CustomVision
I'm using the CustomVision in an ASP.NET Core project to judge the objects.
I trained the model with 20 dog and cat images, but the judgement result is useless.
If I present an image, this model only ...
1
vote
1
answer
100
views
Integration between DataTables and ASP.NET Core MVC: form doesn't read all values
In my ASP.NET Core MVC project, I have a page where I use DataTables. I added the code to render the table names logs with DataTables.
$(document).ready(function() {
var logs = $('#logs')....