1,054
questions
0
votes
1
answer
243
views
How to make .NET framework 4.8 versioning work with Web API
I am working on a .NET framework 4.8 Web API project and I'm trying to enable versioning on the REST API endpoints. All the endpoints are broken and I am unable to figure out what is wrong. Can anyone ...
0
votes
0
answers
55
views
Http PUT method is not working in OData Web API service
I have exposed a SQL Server table using Web API and OData service in C#. In my service, the Get() method is working fine, but the PUT method is not working and I get this error
System....
1
vote
0
answers
25
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
1
answer
28
views
Odata custom action in C# giving Page not found
I am new to odata and trying to follow the tutorial
https://learn.microsoft.com/en-us/odata/webapi-8/fundamentals/routing-overview?tabs=net60
I am trying to create an action reachable on
http://...
0
votes
2
answers
69
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
1
answer
44
views
MuchRandomly Content-Type is not getting seen by a .Net Framework WebAPI server
Documenting a much random issue, probably of .NetFramework, that happens once every 3-4 weeks.
We have 3 load-balanced servers in AWS behind ALB. And occassionally, one of the WebAPI servers stops ...
0
votes
0
answers
100
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
0
answers
12
views
Programmatically identifying controller/action from a path, using the Routing engine
Is it possible, programmatically, given a path string, to use the .NET routing engine and identify which Controller/Action it belongs to?
This functionality already happens automatically when a ...
0
votes
1
answer
136
views
ASP.NET Core 7 Web API : date serialization for Angular form control
In the Person class, Birthday is defined as DateTime.
public class Person
{
public string Name { get; set; }
public DateTime Birthday { get; set; }
}
In my controller, I have an endpoint as ...
0
votes
1
answer
159
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 ...
1
vote
2
answers
882
views
How do I set a prefix in my ASP.NET Core 7 Web API for all endpoints?
I am retrieving a string from my appsettings.json:
{
"ConnectionStrings": {
//several strings
},
"BaseRoute": {
"Base": "/myapi/"
}
}
And I ...
0
votes
1
answer
214
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
0
answers
777
views
Defining API route using API versioning in ASP.NET Core 7 Web API
I am currently working on an ASP.NET Core 7 Web API project and I am facing an issue with defining the API route using API versioning.
Program.cs
builder.Services.AddSwaggerGen(c =>
{
...
0
votes
1
answer
110
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&...
-1
votes
3
answers
326
views
Why is my .net Core API Attribute Routing not working?
I am experimenting with a "Hosted Blazor WASM" project. This problem does not concern the Blazor client router (that is working fine). This concerns the "server-side" router not ...
0
votes
1
answer
2k
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, ...
0
votes
0
answers
77
views
How do I create a custom verb for an ASP.NET Web API?
My original problem is that my GET request was being rejected for the parameters being too long. So I thought, oh I'll just POST the parameter that's getting too long.
Well that doesn't work because ...
1
vote
1
answer
84
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 ...
0
votes
1
answer
74
views
NGINX giving 404's, never proxy passes to fastcgi-mono-server4
Working on getting a skeleton of ASP.Net application running on Ubuntu. Installed all the requisite applications. Just trying to serve index.html or index.aspx to start. However, running through Nginx ...
3
votes
1
answer
1k
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
811
views
ASP.NET Core Web API : my api works on localhost but not on my plesk webserver
I have build an ASP.NET Core Web API and it's working fine on my machine testing it with postmann, all is beautiful, but when I put it in production on my plesk web server, it always says error 404 ...
0
votes
1
answer
700
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 ...
0
votes
1
answer
4k
views
c# .net core api controller mixing route parameters and query parameters
I have a url (that I can't really modify) that has id as part of the route and then a start date and end date as query parameters.
I'm not sure how to mix route parameters and query parameters and ...
8
votes
1
answer
3k
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
0
answers
34
views
WebAPI routing with / in
On my WebAPI .Net Framework 4.8
I have a WebAPI method with this route :
[Route("gdoc/a/G1/{code}/{path}/child")]
This route doesn't fully work because {path} value contains caracters "...
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 ...
2
votes
1
answer
933
views
POST method endpoint not being hit but GET method endpoint works fine
I can't seem to reach an endpoint using the POST method but the very same endpoint works fine when using the endpoint as a GET method. I have mentioned two endpoints below, one of which is a GET ...
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
0
answers
2k
views
What's wrong with these redirects in .NET 6.0?
I have this controller/action:
using Microsoft.AspNetCore.Mvc;
namespace WebService.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class PageController : ...
0
votes
1
answer
329
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 ...
0
votes
0
answers
1k
views
ASP.NET Web API duplicate endpoints
In my ASP.NET web application I have two types of controllers:
1) Web API controllers: 'System.Web.Http.ApiController'
2) Odata controllers: 'Microsoft.AspNet.OData.ODataController'
I have a problem ...
-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 ...
2
votes
3
answers
3k
views
How to set default versioning in ASP.NET Core 6 Web API for my scenario?
Just realised that my understanding about ASP.NET Core 6 Web API versioning is wrong.
This is my controller:
[ApiVersion("1.0")]
[ApiController]
[Authorize]
public class FundController
{
...
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")]
[...
9
votes
3
answers
4k
views
HttpGetAttribute name property not working for routing
I have a WebAPI controller named WeatherForecast with one operation. The operation method looks like follow:
[HttpGet(Name = "GetWeatherForecast")]
public IEnumerable<WeatherForecast> ...
2
votes
1
answer
646
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 ...
3
votes
1
answer
4k
views
API Controller Routing in .NET 6 Doesn't Work Any More
I'm trying to create a standard WebAPI project in .NET 6. I notice that the standard ApiController route doesn't have the leading api route that I like to have. When I add it, the controller breaks. ...
0
votes
1
answer
917
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
176
views
Unexplained delay in ASP.NET WebAPI in hop from web app directory to action route
Under an 'apps' web site, we've created a web application through docker/powershell using:
New-WebApplication -Name 'service_b' -Site 'apps' -PhysicalPath 'C:\ServiceB.API' -ApplicationPool '...
0
votes
0
answers
65
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
294
views
ASP.NET Web Site Not Allowing Axios PUT Access (405 Method Not Allowed)
I've got a controller set up and working for all of my GET requests, but when it comes to the PUT requests my Web Site (not a Web App, if that makes any difference) is returning a 405.
I've got the ...
0
votes
1
answer
665
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 ...
1
vote
0
answers
546
views
REST style API returns 404 when identifier value contains special characters
We have a Web API endpoint defined as follows:
[RoutePrefix("orders")]
public class OrdersStatusController : ApiController
{
[HttpGet, Route("{referenceId}/status")]
public ...
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 ...
0
votes
1
answer
1k
views
ASP.NET MVC GET request with multiple optional filter query params
Im trying to create a GET request that can handle few optional searching/filter params.
The request should look like:
https://localhost:99999/api/computers?ModelName=asus&RAM=2&ScreenSize=22
...
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]"...
1
vote
0
answers
104
views
Is there a Best Practice for multiple Http Post - RPC style, custom MediaTypeFormatter or Other
I'm not looking to start a holy war but looking for maybe a document on best
practices for creating APIs which contain multiple HTTP verbs.
I inherited a 4.7.2 Web API project and trying to straighten ...
0
votes
0
answers
460
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 ...
1
vote
1
answer
35
views
WebAPI URL is not routing as expected
I have the following two methods defined in my WebAPI controller:
public class SocketController : ApiController
{
[HttpGet]
[Route("api/socket")]
public List<SocketInfo> ...
0
votes
1
answer
406
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 ...