37,950 questions
0
votes
0
answers
18
views
Value cannot be null. Parameter name: provider using DI in .NET framework
I have added Microsoft DependencyInjection nuget to a .NET 4.8 project and used this post to help set it up: https://stackoverflow.com/a/73414927/2739613
My code looks like this - Startup.cs:
[...
0
votes
0
answers
28
views
Could not load file or assembly 'Azure.Core, Version=1.47.3.0' even after upgrading to 1.50.0 (Assembly manifest mismatch)
I recently upgraded Azure.Core in my .NET application from 1.47.3 to 1.50.0.However, even after the upgrade, my API is still throwing this exception:
System.IO.FileLoadException: Could not load file ...
2
votes
1
answer
59
views
Validator access to database
My question is how do I need to validate fields. I have this class (request dto):
public class CompleteGoogleRegistrationRequest
{
public string IdToken { get; set; } = string.Empty;
public ...
Advice
0
votes
2
replies
50
views
Deploying ASP.NET API and ASP.NET MVC app on the same IIS default site
I have this scenario: I have an ASP.NET API which is deployed on IIS under the default web site. I have added the API by right click on default web site -> add application. API is working fine and ...
0
votes
0
answers
48
views
Multiple Change Notification from Microsoft Graph, how to solve this?
I am trying to receive change notifications from Microsoft Graph whenever an event is updated (created, deleted, or updated).
I have successfully managed to create subscriptions. The URL that receives ...
0
votes
0
answers
79
views
How to return data annotations error message in one string?
I'm using data annotations from System.ComponentModel.DataAnnotations in my ASP.NET project. I get an error message where you can describe the requirements such as "Name is required" and etc....
0
votes
3
answers
153
views
Resolving a circular/recursive dependency with dependency injection
Say I have this interface:
public interface IExample
{
string GetSupportedExtension();
void DoWork(Stream input);
}
a concrete implementation like:
public class PdfExample : IExample
{
...
0
votes
1
answer
112
views
Why is insert failing in .net Web Api
On inserting ServiceInfo the insert fails. It is failing on Foreign Key JobResult.JobId here are classes.
//------------------------------------------------------------------------------
// <auto-...
0
votes
0
answers
60
views
Autofac: ObjectDisposedException when resolving dependencies from factory delegate in ASP.NET Web API
I have an ASP.NET Web API project using Autofac for dependency injection.
I register a factory for creating ICommandExecutor based on an enum:
builder.Register<Func<CommandType, ICommandExecutor&...
0
votes
1
answer
120
views
Cannot see my API call on frontend console?
fetch('https://localhost:7077/api/test/users')
.then(res => res.json())
.then(data => console.log('Users:', data))
.catch(err => console.error('Error:', err));
Error:
Promise {<...
0
votes
0
answers
48
views
How can I bind the results from a paginated ASP.NET Web API endpoint to a jQuery DataTables table in my ASP.NET MVC view?
I'm attempting to pass paginated results from a Web API to an MVC application and displaying in the View using DataTable. While I've successfully retrieved the data from the server and transmitted it ...
0
votes
0
answers
72
views
ASP.NET Web API - Model binder validation property name
I have a basic ASP.NET Web API project. When I send a request, the serialization is done using System.Text.Json. However, when I send a non-valid json, for example text instead of number, it returns a ...
1
vote
1
answer
109
views
.NET - TestContainers many instance PostgreSql conflict
I'm writing integration tests in my .NET Web API. I'm using XUnit for this. I am using factory and collection. And everything works as expected. I run factory there I have used PostgreSql database ...
1
vote
1
answer
70
views
Empty GUID is coming to backend
Web API + NextTS
Backend
[Route("GetByPatient")]
[HttpGet("{id}")]
public async Task<ActionResult<List<Booking>>> GetByPatient(Guid id)
{
Debug.WriteLine(id);...
0
votes
1
answer
100
views
Routing in ASP.NET Web API
I'm trying to add a new Web API in a legacy web with VB.NET and .NET Framework 4.8. It has multiple Web API running correctly.
For example - CalendarController.vb:
<RoutePrefix("api/{...
0
votes
0
answers
86
views
Amend ASP.NET Web API to not use Newtonsoft.Json
I am in the process of updating one of our systems to use System.Text.Json rather than Newtonsoft.Json.
I have a Data class that I have amended to use System.Text.Json. This handles calls from MVVM ...
1
vote
1
answer
57
views
How to Deserialize json document using reflection.emit.modulebuilder in system.text.json [closed]
We have a local Web API used for internal clients to retrieve data. We use application/json to transport the data across the Web API.
The retrieved JSON data has a simple structured class 'Response'. ...
-3
votes
1
answer
95
views
Sending and receiving messages from ASP.NET Web API with SignalR [closed]
I have a service that runs on multiple machines behind a router and firewall. I am using SignalR to connect the server behind those devices to a server in the cloud.
I would like to have the client ...
0
votes
0
answers
116
views
AWS XRay Transaction Search Operation name - ASP.NET WebAPI
I am attempting to get Transaction Search in AWS CloudWatch up and running for our API (ASP.NET WebAPI).
I'm using the .NET AWS SDK and have XRay configured as follows:
public class WebApiApplication :...
0
votes
0
answers
45
views
How to read and modify a web.config of an ASP.NET Web API project from an ASP.NET MVC project?
There is a new requirement from the management to allow some specific list of users to update some app settings in the web.config of an ASP.NET Web API project (running on .NET 4.8 and hosted in IIS ...
0
votes
0
answers
30
views
How to use one ASP.NET Web API as OAuth authentication provider for another ASP.NET Web API on .NET 4.8
I have developed an ASP.NET Web API application to run on .NET 4.8. It generates JWT tokens using OAuth.
From my ASP.NET MVC application, I invoke above API endpoints to get access token.
Now, I have ...
1
vote
1
answer
116
views
T5ManagerAPI fails to initialize after .NET 8 publish (works fine locally)
I'm building a .NET 8 Web API that connects to MetaTrader 5 using the MT5 Manager API.
Everything works perfectly when running locally from Visual Studio.
However, after publishing and deploying the ...
0
votes
1
answer
95
views
How can I set up RabbitMQ in .NET Minimal Web API to then be able to use it in my services?
I want use AMQP connection string. I want to create a single shared connection (and channel per app lifetime to avoid resource exhaustion.
0
votes
0
answers
39
views
.NET MAUI Blazor App Generate Sitemap Error EntityRef: expecting ';'
I am trying to generate a sitemap.xml file form MAUI hybrid app in C#9
I have created a sitemap1 page which renders a static sitemap but I am getting error.
@page "/sitemap1"
@inject ...
-1
votes
2
answers
97
views
Issue with sending emails with MimeKit
I've been trying to send a 'forgot password' email for my website. I am using a template html file with replaced text to send new randomized credentials to a user. I have so far been unable to send ...
0
votes
0
answers
60
views
Url.Action can't resolve GET url while other actions do work
I have a Web API controller that inherits from ControllerBase for invoices. It contains these endpoint definitions:
[HttpGet]
[Route("{id:guid}")]
public async Task<ActionResult<...
1
vote
0
answers
52
views
SignalR Client does not connect with Web Socket and Server Sent Events Options but it connects with LongPolling
I used signalr with backend polling as a background service in my .NET web api project. However, when I try to connect to my hub from the client, it throws System.IO.IOExpcetion. I checked if web ...
0
votes
3
answers
91
views
Web API not showing swagger UI after Elasticbeanstalk deployment
I just deployed my web api to elasticbeanstalk but it doesn't render anything, even swagger ui. This is my environment which shows that the status of it is healthy and okay:
Then this is the ...
0
votes
1
answer
70
views
ASP.NET Core API in Docker on Linux
I have created a ASP.NET Core Web API app with Docker enabled just using the auto generated boilerplate code. Running on Docker on my Windows dev machine works just fine. But when I deploy the app to ...
0
votes
0
answers
49
views
Running ASP.NET Web API on IIS Express getting ANCM error
I am running an ASP.NET Web API application for .NET Framework 4.7.2, and when I try to run it in on my Windows 11 dev machine via IIS Express, the app is crashing with the following error:
HTTP ...
0
votes
0
answers
41
views
Sending tokens when redirecting
I am working with OAuth in my ASP.NET API for a web app + mobile app, anyway lets use Google as an example here the user authenticates using the Google provider then Google calls my API and I issue a ...
0
votes
1
answer
61
views
There was an error while performing this operation" error when publishing an old ASP.NET web project on IIS
I'm trying to publish an old ASP.NET web project on IIS (Internet Information Services). However, when I click on Handler Mappings in IIS Manager, I receive the following error message:
SSL Settings
...
3
votes
1
answer
219
views
How to configure options to display StackTrace with AddProblemDetails() based on environment in ASP.NET Core?
I have my ASP.NET Core 9 Web API app using custom ExceptionHandlerMiddleware Middleware to handle all exceptions as shown below:
public sealed class ExceptionHandlerMiddleware(IWebHostEnvironment env, ...
0
votes
0
answers
33
views
SwaggerResponse add "Field" suffix to property name
I have an issue with Swagger model preview. I using ASP.NET Web API.
It shows me this model:
But all model properties - is a private property names.
So, on my opinion there must be Id instead of ...
0
votes
1
answer
46
views
Asynchronous File Validation Method Not Responding in Docker Environment
I'm working on an ASP.NET Core application running inside a Docker container. I have an API endpoint that processes a file asynchronously. The method picks a pending file, triggers an async validation ...
1
vote
0
answers
71
views
ASP.NET Web API on .NET 4.8 - can't load assembly
I have a .NET 4.8 (migrated from .NET 4.5.2) ASP.NET Web API that I have deployed to a dev server and it is working fine.
I take the same code and deploy it to a qa server, and I am getting the ...
0
votes
1
answer
37
views
Multipart form post only works if you look at it first
I'm calling a rest endpoint that accepts a multi-part form data request. One of the fields is a file and I'm using a 42k test png image.
I'm using the HttpClient to make the request like so:
using var ...
0
votes
0
answers
28
views
Seeing rst error when netscalar is trying to connect to REST API
Issue with test netscalar REST API. We do not see issues with local REST API. Attached tcp stream from wireshark.
Netscalar ip sends syn to app server then in second line in screenshot app server ...
0
votes
0
answers
49
views
App Authentication with ADFS, OpenID Connect and ASP.NET WebAPI 9.0
I have an iOS App that connects to an ASP.NET WebAPI on the server side for CRUD operations.
I now need to add authentication against a Active Directory Foundation Service (AD FS 2019) to protect the ...
0
votes
0
answers
175
views
How to send request to API that uses MessagePack with MagicOnion using Postman
I have an API that is using MagicOnion and MessagePack in .NET. I am using swagger like this:
public static IServiceCollection AddMagicOnionServices(this IServiceCollection services)
{
services....
1
vote
0
answers
66
views
No sharing cache, using IMemoryCache
My api depends on some programs that are expensive to start up for each call. I am trying to inject a cache that contains the cached objects wrapping the programs so they can be reused without killing ...
0
votes
1
answer
141
views
Certificate error connecting Android Emulator to API on localhost
I'm building a .NET Maui app using VS2022. I'm testing it using the Android emulator. The app gets its data from an API that is running on my local machine. The API is called from C# code but also ...
0
votes
1
answer
73
views
Getting error key name instead of localized message in API response
Example of values in ErrorMessages.resx
Or example in text
name: "OrderIsClosed"
neutral value: "Can't edit closed order."
uk-UA: "Не можна редагувати закрите замовлення.&...
0
votes
0
answers
56
views
How to get other API request url in my API and set audience?
I have two APIs, MainApi and IoApi.
I try to set JWT token for authentication, when I try to get data from IoApi, first of all get Token and then get authorize data.
But in my case, I set the audience ...
1
vote
0
answers
54
views
Cross-domain cookie (.NET & React)
I have a hosted ASP.NET Web API on smarter asp, and I am accessing said API using a React application locally (localhost). The issue that I am facing is that the cookies are set in the response ...
0
votes
0
answers
65
views
Cookies not being set in client browser from an ASP.NET Web API
I have an ASP.NET Web API and a react frontend, I hosted the backend on smarter asp and since I hosted, when I try to sign in using the frontend app, it fails to set the cookie in the browser, but I ...
0
votes
0
answers
108
views
ASP.NET Web API : "Error reading MIME multipart body part" exception
I'm having an issue when posting a file to my web server. I get this exception:
Exception raised during upload handling.
IOException: Error reading MIME multipart body part.
StackTrace:
at System.Net....
0
votes
1
answer
187
views
How to send email as behalf of; in SMTP server which only allows email sent from 1 address
I have an email functionality in my .net Web API and it works fine in dev/Testing. But In UAT its not sending emails. On further investigation, found that UAT SMTP server is only allowing emails from ...
0
votes
2
answers
2k
views
Trying to use scalar with .net9, getting the error Request finished HTTP/2 GET https://localhost:7160/scalar/v1/scalar.aspnetcore.js - 404
Trying to implement Scalar in a .net9 aspcore app.
Doing the basics by using OpenApi. When i run it I see the UI but i dont see any of my methods. In the output window i see Request finished HTTP/2 ...
1
vote
1
answer
109
views
ASP.NET Web API IEnumerable.ToArray return
The ASP.NET Web API template contains a sample method:
public IEnumerable<WeatherForecast> Get()
{
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = ...