Questions tagged as 'asp.net-web-api'

1
answer

HttpContext.Current.Request.IsLocal does not work in Startup class

I'm trying to use HttpContext.Current.Request.IsLocal; in an application web api 2 in class Startup method Configuration(IAppBuilder app) . The idea is to only upload a server hangfire if it is in production,...
asked by 13.08.2015 / 16:25
1
answer

IIS Express or Owin self host (as service)

What are the advantages / disadvantages of these two approaches. Some features: It will be a REST server. The project in the beginning will have few requests Local server (not cloud)
asked by 26.07.2015 / 01:27
1
answer

Calling methods in class controller (asp.net web.api) to work while changing parameter name

I have a question on using the asp.net web api with angularJS that follows below. I have 2 methods in my controller class (ItemsController.cs): public void Put(int id, [FromBody]Item value) { } and [ActionName("UpdateItemFees")] [HttpP...
asked by 24.09.2014 / 20:54
1
answer

Webapi view content in a view

Hey guys, how are you? I'm developing my first application on web api asp.net . And I'm having trouble displaying the content in a view . Controller: public class ListaPresenteController : ApiController { p...
asked by 12.07.2014 / 18:51
1
answer

Web API 2 - Using ReasonPhrase in exception handling

var resp = new HttpResponseMessage(HttpStatusCode.NotFound) { ReasonPhrase = "Nenhum produto encontrado" }; throw new HttpResponseException(resp); This code should return    404 No products found But for some reason it is not worki...
asked by 13.03.2014 / 15:42
1
answer

How to create subfolders for Api in asp.net webapi?

By default, the folder is Controllers I'd like to create other sub-folders Controllers - > Api - > Another folder / other folder2 etc. How do I do this? and how do you configure the router for it?     
asked by 25.08.2014 / 17:47
0
answers

Controller access problem [closed]

ApiController [Produces("application/json")] [Route("api/[controller]")] public class ClienteController : Controller { private IClienteRepository _ClienteRepository; public ClienteController(IClienteRepository clienteRepository)...
asked by 21.08.2018 / 16:44
0
answers

Object comes null in the query, even if it exists

I have this method in my controller [HttpDelete] public HttpResponseMessage DeletaCidade(int id) { Cidade cidade = banco.Cidades.Find(id); if (cidade == null) { return Reques...
asked by 09.08.2018 / 15:11
0
answers

Is it possible to make a related Entity possible to be displayed with Odata Expand (WebApi)?

Hello, I have a question regarding the following situation: I have an Entity that I defined in my model as TaskFreq public partial class TarefaFreq { [Key] public int ID { get; set; } public string Name { get; set; } } I created...
asked by 26.07.2018 / 20:12
0
answers

Solved - Problem with a Web Api calling another Web Api

I'm developing newbie for web environment and I'm having a very bizarre problem, so the text should stay long to try to explain it. I have the following scenario: An angular front end that calls a Web Api (1), this Api Web, in turn, in some c...
asked by 31.05.2018 / 17:41