1,050 questions
2
votes
1
answer
131
views
ASP.NET Core Web API routing is not using https
Question
Why does dotnet run in my ASP.NET Core Web API use http only, and not using https, as well?
Details
I am working on Exercise - Create a minimal API from the ASP.NET team. According to item 3 ...
1
vote
0
answers
159
views
Upgraded OWIN libraries from version 3.0.1 to 4.2.0 Http RequestUri is coming in capital later
After upgrading the OWIN libraries from version 3.0.1 to 4.2.0, the Http RequestUri is now coming in capital letters. This means that if I am requesting from the front end like http://localhost/...
0
votes
2
answers
179
views
Hosting multiple web APIs in the same process in .net
We have a microservice architecture with each microservice currently being hosted in its own process, and deployed via its own docker image. Totally school book separated.
On a source level, all ...
0
votes
0
answers
107
views
How to implement POST in Web API using C# with normal URL in web browser?
Basically, I am trying to make a dynamic SQL controller for Web API. I am having an issue trying to just type the normal URL path of the Web API and using the insert columns to see if I will get the ...
0
votes
1
answer
231
views
How to use RoutePrefix in sub folders in Controller folder in .net core 6 Web API Application?
I am trying to call controller action in subfolder located in main Controller folder. I changed RoutePrefix in controller and app.MapControllerRoute() in program.cs different ways. But my postman call ...
0
votes
1
answer
224
views
API Upgrade from .Net Framework to .Net 6.0 throwing 404 error in Postman
I have the following code which was working fine in .Net Framework but after upgrade it's throwing 404 error. This is basically my code :
[RoutePrefix("API")]
[BasicAuthenticationFilter]
...
0
votes
1
answer
197
views
AmbiguousMatchException when truing override parent ASP.NET controller
almighty All!
Second day passed... Need Help!
I have two controllers: base DocumentController and derived InvoiceController in ASP.NET C# WebAPI application**:**
[ApiController]
[Route("Documents&...
0
votes
1
answer
3k
views
Multiple routes with and without version for the same controller in .NET Core is not working
I want to create two routes, one with version and another without, to point to the same controller without decorating the controller methods.
I have defined two routes at the top of the controller, ...
1
vote
1
answer
114
views
Why is PUT throwing an Error 400 in my WebAPI?
First time working with web APIs and I can't seem to make the PUT method work, while everything works fine (get, post and delete).
I'm trying to do, what I think it is, a very simple call to update ...
3
votes
1
answer
2k
views
Asp.Versioning.Http AmbiguousMatchException: The request matched multiple endpoints on controllers
I am trying to achieve header based versioning on my controllers with Asp.Versioning.Http package version 6.4.0
it is supposed to be super simple here however i get AmbiguousMatchException: The ...
0
votes
1
answer
783
views
.Net 6 Web API: Multiple Base Routes AND Named Routes
I'm working on converting an ASP.NET Web API 2 to a .Net 6 Web API and ran into a problem when using Versioning.
The problem I'm running into concerns named routes.
I want my API to be able to be ...
10
votes
1
answer
4k
views
MapControllers not finding ApiControllers in class library
In .NET 5 this was working, but since moving to .NET 6 and using the more minimal WebApplication to spin up a REST API, I've hit a wall.
To replicate this, I create a simple .NET 6 Console App and in ...
0
votes
1
answer
1k
views
Multiple ApiControllers for ASP.NET Core Web API
I have been trying to figure out how to use multiple [Route("[Controller]")] attributes in my two controller files.
From what I have looked it up it seems possible, and even MS docs say you ...
1
vote
2
answers
1k
views
HttpGet route not found
I have built a controller. For some unknown reason the end point is not reached. Unfortunately I do not understand why.
[Route("api/realestates")]
[ApiController]
public class ...
0
votes
1
answer
510
views
Route that automatically gets name from webapi action
I have ApiController that looks like
[RoutePrefix("Companies")]
public class CompanyController : ApiController
{
[HttpGet]
[Route("GetCompanyProfile")]
public ...
-1
votes
1
answer
2k
views
How to call HTTP POST method from another Controller which Have a HTTP GET method in WEB API 2
I am working on a project which have scenario to redirect to httppost method from another controller which have a httpget method. Can you guys suggest me a good approach to achieve it?
Example is ...
1
vote
0
answers
154
views
WebAPI: Make operation method enabled/visible only for minimum/maxium API version
I have a simple WebAPI controller, looks like this:
[Authorize]
[ApiController]
[Route("v{version:apiVersion}/[controller]")]
[Route("[controller]")]
[ApiVersion("1.0")]
[...
2
votes
1
answer
714
views
Web API partially (start with) match route in Controller
How can I map multiple urls to one action method? For example http://localhost:10000/api/ABC and http://localhost:10000/api/ABCDCD will map to same action name because both starts with ABC. I can't ...
0
votes
1
answer
1k
views
Blazor WASM api call gets 404 on POST but 200 on GET
I'm working on a Blazor WASM project, and I have a page that needs to post a file to the server. So I wrote something like this:
@page "/Test"
@inject HttpClient httpClient
<h4>Please ...
0
votes
0
answers
66
views
Model binding for number with trailing whitespace
I have a web api controller with HttpGet method inside.
The controller sets it's route in a parametrized RouteAttribute (catalogId doesn't have :int or :long rules by an intention).
The controller's ...
0
votes
1
answer
768
views
Web API 2 Generic route with every controller
I am working on web api 2.0 and trying to achieve below url to access with every controller. I have created a base controller which I inherited to every controller. Now I have a scenario where I need ...
0
votes
2
answers
3k
views
Pass url path as param in web api endpoint
I have this controller with one method which receives two variables. One is the culture, the other is a path.
public class WebsiteContentController : ApiController
{
[HttpGet]
public ...
1
vote
1
answer
226
views
.Net Core Web API Request Redirecting
I have controllers AController and BController and both of them has a method that name is upload.
This is the sample code;
public class AController : ControllerBase
{
[HttpPost("[action]"...
0
votes
0
answers
520
views
Program.cs Main Function is not hit when Asp.NET core 5 web api
Hello I'm getting a problem not getting hit into Program.cs . We converted this project from previous .NET core . Now we are using latest .NET core 5 web api . I think when the first application run ...
0
votes
1
answer
447
views
Url matching difference in ASP.NET Web API vs ASP.NET Core
I am trying to find the difference in terms of how URL matching is different in both these frameworks
I know the following is true for ASP.Net Web API, would like to know is it true for ASP.NET core ...