37,950 questions
15
votes
4
answers
14k
views
Swagger not working correctly with multiple versions of ASP.NET WebApi app
Please help me with this, it looked easy at first, now I'm late in the project:
I'm trying to setup API versioning for a ASP.NET WebApi project, along with Swagger. The API versioning works fine, ...
327
votes
16
answers
377k
views
HttpClient not supporting PostAsJsonAsync method C#
I am trying to call a web API from my web application. I am using .Net 4.5 and while writing the code I am getting the error HttpClient does not contain a definition PostAsJsonAsync method.
Below is ...
156
votes
4
answers
69k
views
Why derive from ControllerBase vs Controller for ASP.NET Core Web API?
I am following this tutorial for creating an ASP.NET Core Web API, and in the section on adding a controller, the tutorial gives code to replace the template code for a controller. One of the things ...
1
vote
1
answer
1k
views
Dynamically replace downstream Host in Ocelot gateway
I have an ocelot gateway that is routing API requests to multiple microservices that are supporting multitenancy.
However, I wanted to use the azure storage APIs to simplify the solution instead of ...
271
votes
23
answers
416k
views
Entity Framework Core: A second operation started on this context before a previous operation completed [duplicate]
I'm working on a ASP.Net Core 2.0 project using Entity Framework Core
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.0.1" />
<PackageReference ...
0
votes
0
answers
47
views
Legacy VB.NET Hide Stack Traces For Bad Requests To Web Service
I am working on a legacy Web Forms project written in VB.net. When an authorized client makes a bad request, my application response returns a full stack trace that I want to hide.
I have a redirect ...
6
votes
2
answers
10k
views
How to remove the default charset in HttpClient Request Header C#
I am trying to hit an API from C# code. I am unable to get the response and receiving the status code "500 - Internal Server error".
Found the reason that the "Charset-UTF8" is getting appended in ...
2
votes
1
answer
3k
views
Swagger UI execute button not working when file is uploading
One of the endpoint in my API is for uploading a file and submitting details about the file . The API is implemented in ASP.Net Core. NSwag package is installed in my project. OAS 3 specification is ...
3
votes
5
answers
15k
views
How to display a date in <input type = "date"> field when using Angular
I want to get some inputs values from the user by using a form and save it in the database. Then I want to display the saved data using this same form. But even though I get the values from these ...
0
votes
1
answer
59
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
47
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 ...
22
votes
5
answers
108k
views
AuthenticationException: The remote certificate is invalid because of errors in the certificate chain: UntrustedRoot, NotValidTime
I am consistenly receiving the following error when developing and authenticating locally in Visual Studio:
AuthenticationException: The remote certificate is invalid because of errors in the ...
214
votes
9
answers
293k
views
Specifying a custom DateTime format when serializing with Json.Net
I am developing an API to expose some data using ASP.NET Web API.
In one of the API, the client wants us to expose the date in yyyy-MM-dd format. I don't want to change the global settings (e.g. ...
538
votes
19
answers
464k
views
Pass an array of integers to ASP.NET Web API?
I have an ASP.NET Web API (version 4) REST service where I need to pass an array of integers.
Here is my action method:
public IEnumerable<Category> GetCategories(int[] categoryIds){
// code ...
3
votes
1
answer
202
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
1
answer
57
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
...
21
votes
4
answers
25k
views
How to use Ninject with ASP.NET Web API?
In MVC I simply make the class NinjectControllerFactory that implements DefaultControllerFactory interface then do some bindings in it. at last in Global I run it:
ControllerBuilder.Current....
0
votes
1
answer
39
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
65
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 ...
191
votes
17
answers
107k
views
Unauthorised webapi call returning login page rather than 401
How do I configure my mvc/webapi project so that a webapi method called from a razor view doesn't return the loginpage when its unauthorised?
Its a MVC5 application which also has WebApi controllers ...
18
votes
3
answers
84k
views
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed
I am having an issue :
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to ...
3
votes
2
answers
6k
views
Create annotation via CRM Web API
Anyone knows how to create an "annotation" using CRM Web API. I can create other objects such as account and contacts but annotation attachment is a no go. Seems like my object is missing something.
...
0
votes
1
answer
201
views
Web API add a Header parameter for all Endpoints in Swagger using NSwag+Owin
I wish to add a custom header parameter in Swagger for all my endpoints in my ASP.NET Web API application running ASP.NET 4.8 using NSwag.
I have found many, many references explaining how to do this ...
1
vote
2
answers
681
views
I am getting error on Post method of MVC controller using AngularJS
I am using angualarJS and asp.net web API but my code always breaks on post request in the asp.net controller and this is the error I got
An exception of type 'System.ArgumentNullException' occurred ...