Questions tagged [asp.net-web-api]

ASP.NET Web API is a framework for building HTTP services for clients like browsers and mobile devices. It is based on the Microsoft .NET Framework and an ideal choice for building RESTful services.

ASP.NET Web API is a framework that makes it easy to build that reach a broad range of clients. These Web-APIs can be consumed by any clients capable of communicating via HTTP (including browsers, mobile clients, desktop applications, and other web applications). It is useful for building ful applications on the Framework.

Web API was created by Microsoft and released on 15th August 2012.

Web API can be hosted:

  • within
  • outside of ASP.NET and IIS - also known as "self-hosted" (i.e. directly inside a Windows service, WPF application or console application)
  • in memory (not accessible via HTTP from outside of the process, but useful for end-to-end testing scenarios or mocking).

As Microsoft had multiple approaches within its technology stack for creating REST services; WCF Web API, ASP.NET MVC controllers returning JsonValue results; this represents a rationalisation and merging of these efforts. The ASP.NET Web API stands separately from WCF and does not deprecate (at this point) the WCF Web HTTP programming model.

Related tags

37671 questions
12
votes
3 answers

Testing a Web API method that uses HttpContext.Current.Request.Files?

I am attempting to write a test for a Web API method that uses HttpContext.Current.Request.Files and after exhaustive searching and experimentation I cannot figure out how to mock for it. The method being tested looks like this: [HttpPost] public…
AJ.
  • 16,368
  • 20
  • 95
  • 150
12
votes
2 answers

Is that a best practice to host WebApi as a seperate project

I am working on an Single Page Application with Web Api and Angular JS. I want to grab all the best practices for a great spa applications. I want to know that is that a best practice to host Web Api project as a seperate project or just include…
Ravi Mittal
  • 1,947
  • 4
  • 22
  • 37
12
votes
4 answers

WCF / WebService to act as Listener for MQ Message?

Perhaps I am barking up the wrong tree - but I have a set of services (WebAPI and WCF) that use WebSphere MQ to interact with other systems. This works without issue - until I now need to find a way of listening for messages on one of the queues. Is…
BlueChippy
  • 5,935
  • 16
  • 81
  • 131
12
votes
3 answers

Change Build Output Directory of WebApi Application

I am part of a team working on a large application. I am a new addition to this team and am building a new piece of the app. As part of this process, I've created a WebApi application that will expose some HTTP endpoints through which I will…
SethGunnells
  • 1,269
  • 1
  • 12
  • 19
12
votes
2 answers

How to override default unhandled exception output in Owin?

I've written simple server using Owin Self-hosting and WebApi: namespace OwinSelfHostingTest { using System.Threading; using System.Web.Http; using Microsoft.Owin.Hosting; using Owin; public class Startup { public…
rufanov
  • 3,266
  • 1
  • 23
  • 41
12
votes
2 answers

Host Web API as Windows Service using OWIN

I'm trying to run a Web API application as a Windows Service using OWIN. However, I get the following message, when trying to start the service: The [ServiceName] service on Local Computer started and then stopped. Some services stop automatically…
SabrinaMH
  • 221
  • 1
  • 3
  • 11
12
votes
1 answer

OWIN/OAuth2 3rd party login: Authentication from Client App, Authorization from Web API

I am trying to create a Web API that allows the API's clients (native mobile apps) to login using a 3rd party cloud storage provider. I'm using the following general flow from Microsoft: Here is what I am trying to achieve: I am using the default…
mayabelle
  • 9,804
  • 9
  • 36
  • 59
12
votes
2 answers

ASP.NET Web API Help page under separate project

I have ASP.NET Web API project and I want to add a Help page, but I want it to be in a separate project. Is it possible ?
koryakinp
  • 3,989
  • 6
  • 26
  • 56
12
votes
2 answers

Method not found: 'Void Newtonsoft.Json.Serialization.DefaultContractResolver.set_IgnoreSerializableAttribute(Boolean)' (webapi and PCL)

Similar to this question, which was marked as a duplicate (so I couldn't answer it directly). I have a webapi project, which references a PCL project. I was getting this DefaultContractResolver error intermittently. I had tried all of the…
dbruning
  • 5,042
  • 5
  • 34
  • 35
12
votes
2 answers

asp.net web api self hosting / owin / katana

There are multiple question I have around self-hosting Self Hosting Nuget There are 2 nuget which provide self hosting : Microsoft.AspNet.WebApi.OwinSelfHost and Microsoft.AspNet.WebApi.SelfHost, so does microsoft have 2 implementation of self…
harishr
  • 17,807
  • 9
  • 78
  • 125
12
votes
1 answer

Index a dynamic object using NEST

I am building an API application that essentially allows a user to build a document, which can be structured however they want, that will be stored in Elasticsearch. Essentially, I'm providing a simple interface for users to access our Elasticsearch…
Ellesedil
  • 1,576
  • 1
  • 20
  • 44
12
votes
5 answers

Is there any sample for PayPal IPN

I have an Asp.Net WEB API 2 project and I would like to implement an Instant Payment Notification (IPN) listener controller. I can't find any example and nuget package. All I need is to acknowledge that the user paid with the standard html button…
Marc
  • 16,170
  • 20
  • 76
  • 119
12
votes
3 answers

Passing JSON Array from Javascript to Web API Controller method

I was not able to get the JSON array parameters in web api controller method (SaveDetails). Here are my code. JavaScript Code: $.ajax( { url : "api/Test/SaveDetails", type : "POST", data : { …
Saravana Kumar
  • 3,669
  • 5
  • 15
  • 35
12
votes
6 answers

Return camelCased JSON from Web API

I'm trying to return camel cased JSON from an ASP.Net Web API 2 controller. I created a new web application with just the ASP.Net MVC and Web API bits in it. I hijacked the ValuesController like so: public class ValuesController : ApiController { …
beaudetious
  • 2,354
  • 3
  • 36
  • 60
12
votes
3 answers

How to customize error message of OAuthAuthorizationServerProvider?

We are using the OAuthAuthorizationServerProvider class to do authorization in our ASP.NET Web Api app. If the provided username and password is invalid in GrantResourceOwnerCredentials, the call context.SetError( "invalid_grant", "The user name or…
Mark Vincze
  • 7,737
  • 8
  • 42
  • 81
1 2 3
99
100