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 ideal choice for building RESTful services.
0
votes
0answers
27 views
Passing constructor arguments to injected objects in the MVC controller
I am developing a MVC application using .net, I am using autofac as the IoC container.
I have service class which needs a parameter in the constructor. And the parameter is resolved at run time from ...
0
votes
4answers
66 views
Internal error 500 on POST web api
I have a problem with my web api application. I get an internal error 500 when i try to post(save) a new user in my db.
The function bellow is the one that i use to make the client call.
public ...
1
vote
1answer
25 views
“Object reference not set to an instance of an object” when creating a new Web API controller with EF Scaffolding in Visual Studio 2012
I have an MVC4/Web API project, with an Entity Framework, Code First data model. When I try to create a new API Controller with read/write methods using a data context & model, I get an alert ...
0
votes
2answers
47 views
Calling ASP.NET Web Api method with PHP
I have the following web method in my web api controller
public HttpResponseMessage PostMakeBooking(FacilityBookingRequest bookingRequest)
{
var returnStatus = HttpStatusCode.OK;
...
0
votes
1answer
55 views
Best practice for ASP.NET Web API design?
I'm currently trying to create a REST'ish web service backend with an ASP.NET Web API, EF5 Code First approach. Looking now for some advice to avoid the maybe most known novice errors.
Whats the best ...
1
vote
1answer
39 views
Why aren't actions showing in WebApi Help Page
I have a WebApi project in Visual Studio 2012. I created it from the template and have since added in the HelpPage stuff through the use of NuGet. Below is my example.
HierarchyController.cs
public ...
0
votes
1answer
39 views
Getting a web application's URI during startup
I need to find out the base URI of an ASP.NET Web API application hosted in IIS 7.5+, right after the app's startup, but before any client request may have reached it. The scenario where I need this ...
1
vote
2answers
30 views
Deserialize a JavaScript object as Dictionary<string, string> via ModelBinding in Web API
I have a simple JavaScript string and object:
var name = "Scarlett Johansson";
var args = { arg1: "foo", arg2: "bar" };
And I want to pass them via $.ajax to a Web API controller:
public string ...
2
votes
1answer
24 views
Setting WWW-Authenticate response header within a DelegatingHandler causes havoc on w2k3
I am using a custom authentication mechanism by means of sending a session token. The presence of the token is checked in a DelegatingHandler which sets the current principal accordignly. If the ...
1
vote
1answer
19 views
How to set the EmitDefaultValue to false globally for all Data Members in Web API?
I'm using Web API and I've set the below property so that the default value is not displayed when members are serialized:
[DataMember(EmitDefaultValue = false)]
public string EventName { ...
1
vote
1answer
29 views
Calling a constructor on custom view model changes output type to JSON
I'm developing a WebAPI service and have been confronted with a curious problem. When calling a ViewModel with a constructor why is the return type changed to JSON from XML?
Code from controller;
// ...
0
votes
1answer
20 views
Breeze 1.3.5 with odata and Navigation properties
I am using Microsoft WebAPI OData nightly that supports $expand and breeze 1.3.5 to query the data
When i use breeze to query the entity:
via ...
0
votes
0answers
16 views
multiple controller parameters using xmlSerializer
Is there a way to pass multiple parameters to a web api controller using HttpClient.PostAsync and the XmlMediaTypeFormatter with UseXmlSerializer set to true?
I have the following controller which I ...
0
votes
1answer
28 views
Accessing Route Data in DelegatingHandler using MVC 4
I just Register these routes now how can I get Apikey value in WebApiKeyHandler.cs since it is not part of query string so I am getting null. Also guide me how I am validating keys is best practice ...
1
vote
2answers
32 views
WebApi: */* media type handling
In my application I'm making some javascript requests to my Api Controllers to get some html formatted strings. When those requests are made with Accept: */* HTTP header (jQuery $.get method), so by ...
4
votes
1answer
69 views
Using a 2.0 framework assembly in a 4.5 framework WebApi project
I have a 'core' assembly with all the logic, and it uses a 3rd party component written in 2.0. When I try to run my WebApi (4.0) project (4.5 framework) that exposes the core functionality, I get the ...
1
vote
1answer
28 views
Migrating WCF Services to ASP.NET Web API - reuse ServiceAuthorizationManager?
I am migrating some WCF services to Web API. Is is possible to reuse the ServiceAuthorizationManager or is it strictly for WCF?
3
votes
3answers
60 views
How can I call different GET Methods in the same Controller utilizing different parameters?
I have a Controller that contains two different Get methods. One takes an int value, while the other takes a String value, like below:
public class AccountController : ApiController
{
public ...
1
vote
1answer
30 views
Web Api route not found
I have already researched many of the questions regarding this topic. I'm no slouch when it comes to MVC3 but for the life of me I can't figure out why my Web Api in MVC 4 routing is failing.
...
0
votes
1answer
22 views
Fluent NHibernate Configuration invalid or incomplete - 3rd party types in mapping
I am trying to convert a ASP.NET Web API project over to use Fluent NHibernate. It's been awhile since I Hibernated. I have a mapping to a model which is composed of 3rd party types. For example:
...
0
votes
1answer
57 views
Async service facade in .NET 4.5
I just upgraded to .NET 4.5 and I want to take advantage of the asynchronous method features. Specifically, I have a facade that makes 4 different api calls and aggregates the responses into a single ...
0
votes
1answer
24 views
Downloading a CSV from Web API using Media Formatters
I'm having trouble with downloading a CSV from web API. I followed the instructions at this site http://www.asp.net/web-api/overview/formats-and-model-binding/media-formatters on media formatters and ...
0
votes
1answer
8 views
System.UnauthorizedAccessException on IIS7.5, full control everywhere
I'm trying to get an ASP.NET Web API application running on IIS7.5. I've added an application tot the default web site for it. It's running in the DefaultAppPool, with anonymous authentication enabled ...
1
vote
1answer
17 views
How to handle two different HttpPost in one controller
I've got a generic controller with
[HttpPost]
public void Create(T entity)
{
...
}
and an extra controller wich inherits from the generic controller and has got this method in it:
...
0
votes
1answer
32 views
ASP.NET WebApi OData support for DTOs
I have Project entity and ProjectDTO.
I'm trying to create an WebAPI controller method that can take and return ProjectDTOs and make it support OData.
The problem is that I'm using ORM that can query ...
1
vote
1answer
21 views
Application_Error isn't triggered in asp.net web api
How do I get the Application_Error triggered in an ASP.NET WebAPI application? The error I'm having now is that when we resolve a controller through NInject and fails it won't got into ...
0
votes
2answers
18 views
fetch gmail calendar events in mvc 4 application
I am working on mvc 4 web application. I want to implement a functionality wherein the scenario is as follows-
There will be gmail id as input for ex: [email protected]. When user will enter this, ...
2
votes
0answers
22 views
How to use a Database Generated Identity Key in Web Api OData
I've managed to create number of readonly Web Api OData services following the tutorials here: http://www.asp.net/web-api/overview/odata-support-in-aspnet-web-api. I'm therefore employing the ...
1
vote
1answer
38 views
Breeze - self referencing entity
i get some problem using Breeze to execute queries via my ASP.NET web api application.
Here is my entity definition that i want to request on :
[Serializable]
[DataContract]
public class Subject
{
...
0
votes
0answers
19 views
F5 Load Balancer not sending response to AJAX Http DELETE request (ASP.NET Web API)
I've recently created an ASP.NET Web API which has a method that can be called using the Http DELETE verb. It works perfectly on my local development environment, but when I deployed it to our staging ...
0
votes
2answers
25 views
Web API change schema names
I have an asp.net (get) web API that is being consumed using by both JSON and XML clients. Is there any type of attribute that I can decorate my code with that will change the various XML schema and ...
1
vote
1answer
37 views
Why is this Web API method firing twice?
I'm experimenting with a Web API service. I'm trying to do a file download via a GET request. The method fires just fine and hits my break point. I create a response and return it. Then, oddly, the ...
2
votes
2answers
52 views
Dynamic Routing with Web API
I have a WebAPI controller with a Get method as follows:
public class MyController : ApiController
{
public ActionResult Get(string id)
{
//do some stuff
}
}
The ...
0
votes
1answer
37 views
Getting JSON Serialization Entity Framework Self Reference Loop error even after ProxyCreation false when using explicit Include
JSON Serialization (ASP.Net Web API) fails because of self-referencing loop (it’s a common problem, Reason: an entity being requested lazy loads child entities and every child has a back reference to ...
0
votes
2answers
49 views
Filtering a collection deep in an object graph
Here is what I am trying to do:
My ASP.NET Web API accepts a chart "id", a "startTimestamp", and an "endTimestamp" from the client. I need the Web API to select only the "MeasureData" (see the ...
3
votes
1answer
28 views
DataContract Serializer array node names 'd3p1'
Could someone tell me what the "d3p1" node name means in this?
<ActionMessage>
<Data xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
...
0
votes
1answer
36 views
WebApi Odata Windows Store App EndSaveChanges exception
I am trying to create a Windows Store App using a WebApi Odata controller. After some effort I have all the Get requests working, I am now moving onto the CRUD methods, and am getting the following ...
0
votes
1answer
22 views
Get progress notifications with MultipartFormDataStreamProvider and web api
I am currently using this code to submit some files to my web api controller with ajax.
http://www.strathweb.com/2012/04/html5-drag-and-drop-asynchronous-multi-file-upload-with-asp-net-webapi/
I am ...
1
vote
1answer
36 views
How can i unit test an EntitySetController
i try to unit test an EntitySetController. I can test Get but have problems in testing the Post Method.
I played around with SetODataPath and SetODataRouteName but when i call this.sut.Post(entity) i ...
1
vote
1answer
49 views
ASP.NET Web API with Decorations on Models
Technology Used: Code First,ASP.NET Web API (restful service) and HTML.
For code first I have a domain Object called User
public class User
{
[Required]
public Guid Id { get; set; }
...
1
vote
1answer
28 views
what is the advantage of using web api over web method in aps.net
I am familiar with web method.Now i got a suggestion to use web API instead of web method.I had done a demo of asp.net web API it's more closer to a mvc architecture am using the classical asp.net web ...
0
votes
1answer
49 views
Why do I have to speicfy [FromUri] to get this to work?
I am using asp.net web api and one thing that confuses me is the binding when a request is done.
I have this Vm.
[DataContract(Name="Store")]
public class StoreDm
{
[DataMember(IsRequired = ...
0
votes
4answers
61 views
ASP.NET MVC/WebAPI Routing actions
The goal is to allow these four endpoints:
POST v1/invoices
POST v1/invoices/12345
POST v1/invoices/12345/attachment
POST v1/invoices/12345/image
Routing entries:
routes.MapHttpRoute(
...
0
votes
1answer
37 views
Change Web API Response Formatter
I've an APIController on SelfHost Configuration that generates responses like XML Documents:
public XmlDocument Get(int id)
{
XmlDocument doc;
doc = repo.get(id); // simplified
if(doc != ...
0
votes
1answer
29 views
ASP.Net Web Api initial requests are taking too long
Initial requests are taking 3-5 seconds, subsequent calls takes < 500 milliseconds. Service makes a light weight stored proc call and there is no latency found when we profile it.
This service does ...
0
votes
2answers
50 views
Server side validation w/ Breeze JS and custom EFContextProvider
After reading about Custom EFContextProvider and implementing it, I am still trying to figure out what is the best way to perform server side validation and how to apply business rule before ...
0
votes
2answers
33 views
ASP.NET Web API - Authenticated Encrypted JWT Token - Do I need OAuth?
I'm considering using authenticated encrypted JWT tokens to authenticate / authorized access to an ASP.NET Web API application. Based on what I've read so far, it seems to me like it is an option to ...
1
vote
1answer
28 views
Creating a resource that can have multiple representations
Say I have a Widget resource which is made up of a Thingy and a Dooda.
Thingys and Doodas come in various types and the combination of Thingy type and Dooda type will determine exactly what properties ...
0
votes
1answer
38 views
WebAPI: EFMVC + MEF giving same singleton db context on every web call
I am trying to get to grips with WebAPI. I have been looking at the EFMVC project on codplex: http://efmvc.codeplex.com/ I chose to use MEF as my dependency resolver as per this blog ...
4
votes
1answer
53 views
Geo location / filtering and HTTP Caching
I'm trying to add cache support (both HTTP and server) for a ASP.NET Web Api solution.
The solution is geo located, meaning that I can get different results based on the caller IP address.
The ...