Questions tagged [asp.net-core]
ASP.NET Core is a lean, composable, and cross-platform framework for building web and cloud applications. It is fully open-source on GitHub. ASP.NET Core apps can be run on Windows, Linux, or macOS.
71,882
questions
-1
votes
0
answers
9
views
Which one of the three is the best Solution nowadays for moving and visualizing PDFs in ASP.NET Core Web? [closed]
Which one is the best solution for moving and visualizing documents 1) ASP.NET Core Web App, 2) ASP.NET Core Web API, 3) ASP.NET Core Web App (Model-View-Controller) and why?
0
votes
1
answer
20
views
How to add a search bar to layout.html so that it is processed in the controller?
I am trying to make the search accessible from anywhere in the application and processed by the usual method of action in the controller. I really need your help.
the method of action in the "...
1
vote
0
answers
12
views
SignalR send custom class
I would like to use a custom class on SignalR. But an client side I just get 'null' in the class.
Why am I getting such exceptions?
Exception thrown: 'System.Text.Json.JsonException' in System.Text....
1
vote
0
answers
16
views
How can I append strings to Ajax formData together with a file
I am trying to append strings when am sending my form to an Asp Net Core API. I have a file input which I am successfully getting and uploading to the server but now the problem is I am failing to ...
0
votes
3
answers
35
views
How to select the most repeating records in related tables with Entity Framework
My tables here :
In C#
I want to know most repeated 3 categoryName and their count in Blog table, any idea? Thanks
0
votes
0
answers
14
views
Delay when using ApiGateway
I'm a backend developer, and I've developed a WebApi service with Asp.Net Core.
I've also developed ApiGateway using Ocelot library.
From front side, front-end developers use React and Axios as HTTP ...
0
votes
0
answers
32
views
My custom middleware is repeated several times
I have used the following code in the middleware to store the number of visits (according to IP):
First, I check if the user is new or new by getting the user's IP, and then I check if the user has ...
0
votes
0
answers
22
views
The type 'Component' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ComponentModel.Primitives'
I am using Microsoft.CodeAnalysis.CSharp package in my ASP.NET Core project. The System.ComponentModel.Primitives package could not added to my package.
Here is my code:
List<MetadataReference> ...
0
votes
1
answer
23
views
ASP.NET Core Web API - FluentValidationMvcExtensions.AddFluentValidation(IMvcBuilder, Action<FluentValidationMvcConfiguration>)' is obsolete
In ASP.NET Core-6 Web API, I am using FluentValidation.AspNetCore(11.2.1).
I have this code in the Program.cs:
builder.Services.AddMvc().AddFluentValidation(fv => {
fv....
0
votes
0
answers
18
views
How to generate cshtml class file in console app with dotnet cli?
Having a cshtml folder in net 6.0 Sdk="Microsoft.NET.Sdk.Web" project,
using the vs for mac, i can add follow properties in csproj file
<ItemGroup>
<None Update="...
2
votes
1
answer
22
views
Trying to set ContentType for FormFile instance throws an exception
I have the following simple method that creates a simple FormFile for testing.
private static IFormFile CreateTemporaryFile(string fileName, string contentType)
{
byte[] bytes = ...
0
votes
0
answers
21
views
The type or namespace name "Hosting" does not exist in the namespace 'System.Web'
I want to add Google Drive Service my ASP.NET Core Project but I encountered an error. There is a "System.Web" using but Hosting is not working. How can I fix it?
using Google.Apis.Auth....
0
votes
1
answer
17
views
NLog Azure event hub connection string from Azure key vault
I'm working on my .Net Core website and I'm using NLog along with Azure Event hub. I've got that working but the Azure Event hub connection string is hard coded in the NLog.config file right now. I ...
0
votes
1
answer
26
views
Net Core- get unformed id
I also need to perform an orderjoinproduct record within an order record. but there is no id value because the order record has not been made yet. I guess I am getting the following error because this ...
0
votes
2
answers
25
views
Permission Base Authorization in Asp .NET Core [closed]
I want to implement permission base authorization in my asp.net core project but I don't know How To Implement Permission Based Authorization in Asp.NET Core
0
votes
1
answer
41
views
GetConstructor() method returning null value in .Net 6 but the same returning values in .Net core 3.1
I am trying to save the mailmessage in file. So i have used below code to save the mailmessage in file. the same code working in .Net core 3.1 but it's throwing error on .Net 6.
Error Info:
Object ...
0
votes
1
answer
44
views
Find the execution flow when an API is called from postman
Is it possible to call an api such as "localhost/calculate" using PostMan and find out which classes or methods are called in order?
It would be like (GetCalculateResult(), Calculate.cs) -&...
0
votes
0
answers
46
views
Swagger multiple version
Hopefully somebody has tried something similar and provide some guide for me.
I am trying to create multiple versions of Web API. I add below attribute at my controller, so on swagger screen I can see ...
0
votes
1
answer
28
views
MassTransit in AWS Lambda
I am using MassTransit v7 with Asp.Net Core running on Aws Lambda and I want to upgrade to v8. I want to know what is the proper way to use MassTransit in a serverless environment.
The problem I see ...
1
vote
1
answer
83
views
Scoped Service not being shared as expected
Context
For context, my code and problem in question is an almost identical copy of the Blazor Server with EF Core Demo. The primary difference is that all my UI C# is written in base classes using ...
0
votes
0
answers
26
views
Create dynamically form with field dependencies in Blazor
I'm creating a library for generating form in Blazor. The logic is quite straightforward: based on a JSON, the library creates the form, using my custom component. Here a piece of the code of the ...
0
votes
0
answers
21
views
What is the correct naming of dtos in web api? [closed]
We have an Asp.net core 6 web api.
Our API takes as an input DTOS from another API, makes an aggregation to some of them and outputs other dtos to an Angular project.
We would like to distinguish ...
1
vote
1
answer
28
views
Weird error when using Fluent Validation API and Mud Blazor
Using Fluent validation for some NotEqual rules for some of our models and getting an odd error when the validation should succeed. Our model has a couple of fields that are all complex user models. ...
1
vote
0
answers
24
views
Access registered service from Program.cs in ASP.NET Core 6
In my Program.cs file I'm registering two repositories on builder.Services that will be used via dependency injection. However, I now have a case where I need to call one to configure the other. So ...
0
votes
1
answer
51
views
ASP.NET Core Web API - How to secure Web Service using JWT
I have only used JWT for user login authentication. But I have this different task.
I am using ASP.NET Core-6 Web API to implement a Web Service whereby customers will be able to print invoices.
[...
1
vote
0
answers
24
views
Pause fetching new messages from Azure Service Bus in Azure Function
I am creating an azure function using a service bus to make my API more resilient to high traffic spikes. However I am uncertain on how I should handle an offline database as the function still ...
0
votes
1
answer
17
views
The given key 'members@delta' was not present in the dictionary when using using delta query
I have the following code to read users from AAD group using Graph delta query:
public async Task<IGroupDeltaCollectionPage> GetGroupUsersPageByIdAsync(string groupId)
{
...
0
votes
1
answer
20
views
Microsoft.AspNetCore.Mvc.Api.Analyzers produces no output
I've followed the documentation to enable web API analyzers in my .NET 6 web API project. I see Microsoft.AspNetCore.Mvc.Api.Analyzers listed under the Dependencies/Analyzers tree in Solution Explorer....
0
votes
0
answers
23
views
How do make ASP.NET React JS template usable?
I have followed a Microsoft template to get an ASP.NET Core React JS project in visual studio 2022. The end product displays a list of weather forecasts with no navigability in the website. I am ...
-1
votes
1
answer
55
views
.NET confused, too many files
I have a server running tons of apps like IIS, VS, VS Code etc. Can someone tell me what these folders are:
%programfiles%\dotnet\shared\Microsoft.NETCore.App\
Microsoft.AspNetCore.App
Microsoft....
0
votes
0
answers
22
views
Mercado Pago API "Status code: 400 | API message: marketplace is required" exception
I'm trying to create a payment method in my api using Mercado Pago, but I keep getting "Status code: 400 | API message: marketplace is required" on the catch (MercadoPago.Error....
0
votes
1
answer
25
views
How show decimal point in viewbag razor page
I defined a Viewbag in .cshtml file as
ViewBag.version = "2.0";
but when I get the value:
alert(@ViewBag.version.ToString());
It shows as 2, it takes out .0 after
0
votes
0
answers
22
views
Getting navigation properties of your entity when you return a CreatedAtRouteResult
Request:
namespace mediere_API.Requests
{
public class LocalitateRequest
{
public string Nume { get; set; }
public int JudetId { get; set; }
}
}
DTO
namespace mediere_API....
0
votes
2
answers
26
views
How to Upload Files and Save in Database and download another page in ASP.NET Core MVC
For download how to do the functionality in a form that we upload its store binary format how to retrieve data from binary file in the controller action
public IActionResult Index(IFormFile files)
{
...
0
votes
1
answer
49
views
FileNotFoundException in razor view ASP.NET Core
I ran into a strange problem in my project.
This problem occurs when I want to return a specific razor view inside a method. But the point is that this problem only happens when I have used tag ...
1
vote
1
answer
36
views
dapper with oracle view
i am struggling using Dapper with just a select query from a view, the view is created manually from sql developper and working fine both on test and production.
But when i publish the app on windows ...
0
votes
0
answers
17
views
Mediatr dynamically register Notification Handlers based on tenant with Default Asp.NET Core DI Container
I'm trying to use MediatR to send notification in a multiTenant Asp.NET Core 5 API application.
I'm wondering if there's a way to register different handlers per tenant.
Basically I need to be able to ...
1
vote
0
answers
15
views
Why is the 101 upgrade response sent when the other end closes their connection and not immediately after the upgrade request?
I have an console application running asp.net-core and signalR and I'm loggin the requests i receive with serilog.
My signalR hub works fine, I have no complaints there but I cant understand this.
...
0
votes
0
answers
20
views
Third party IIS Module not printing to log files
I have an asp.net core application hosted and webdav enabled in IIS for storing files as well. I want to know when a user saves a file in the webdav server (ie, if opened and saved in Microsoft word). ...
0
votes
1
answer
14
views
xUnit custom UseCulture attribute - does the sample attribute contain any issues?
I have an ASP.NET Core 6 Web API application.
I am writing Unit tests, using xUnit.
I need to change the culture for some tests.
According to this answer here it is recommended to make a custom ...
2
votes
2
answers
53
views
ASP.NET Core async request handler always responds with 200 OK and empty body if it's a separate method
I'm using the ASP.NET Core 6 minimal APIs to build an API. After extracting anonymous/lambda handlers from MapGet into their own methods, some endpoints act erroneously by always returning a 200 (OK) ...
0
votes
1
answer
24
views
Can't connect to SQL Server with Windows authentication with my ASP.NET Core application (IIS server)
I have a problem when I deploy my ASP.NET Core 3.1 application to IIS.
When I provide Windows credentials in the appsettings.json file, I always get this error:
Login failed with DOMAIN\USERNAME$
...
0
votes
0
answers
11
views
dotnet image difference in dockerfile
I m developing a worker service with .net 6.When I dockerized it I pull some images from microsot below
FROM mcr.microsoft.com/dotnet/runtime:6.0
FROM mcr.microsoft.com/dotnet/sdk:6.0
then I can not ...
0
votes
0
answers
16
views
Net Core - Var To SelectList [duplicate]
I'm trying to throw the following promotions object into the viewbag. But I am getting an error like this: InvalidOperationException: Collection was modified; enumeration operation may not execute.
...
-1
votes
0
answers
32
views
How to create relation between entities and dynamic entities dynamically in ASP.NET Core
I have an ASP.NET Core project and I use EF core. I have a dll which contains dynamic entities and their mapping. I get and use these at run time.
var entityMethod = modelBuilder.GetType().GetMethods()...
1
vote
2
answers
39
views
System Aggregate Exception using .Net
I am working on an mvc .net application. When I run dotnet build the solution is built normally with no errors. However, when I run the solution to display the api using swagger, it throws a system ...
0
votes
0
answers
20
views
EPPlus Calculate: System.NullReferenceException
I am using EPPlus 6.0.4 and .Net Core 5.0
While I am using Calculate method, I got null exception error.
public void CalculateSheets(string analyzeFilePath, string pass = null)
{
var ...
-4
votes
0
answers
38
views
Blazor WebAssembly Data Transform Based on Culture [closed]
Is there any concept in Blazor WebAssembly where I could change the date format and Currency more like Pipe concept in Angular Kindly help me out on this one .
Thankyou.
0
votes
0
answers
26
views
How to write a method to get the count of the xx devices using uri in C#
private int GetComXDeviceCount(string envCode, string gatewayType, int Devicescount)
{
envCode.ThrowIfNull();
EnvironmentSettings dspEnvSettings = ...
-2
votes
0
answers
20
views
Cannot read properties of undefined (reading 'setAttribute') after reset zoom in highcharts
I have synchronized Highstock charts. When reset zoom after zooming, throws undefined setattribute error in syncExtremes.
charts = charts.filter(x => x.types[0] == "arearange");
...