wcf-web-api

Hosting a WCF Web API app on AppHarbor?

大憨熊 提交于 2019-11-29 19:51:20
问题 I've implemented a sample app like the one here. It is a really basic app just to get things started. Everything works fine in IIS on my local machine, I've got it running on my IIS Express as well, but now come the tricky part. I do want to host this on AppHarbor, but I get 404 error. I've started a discussion on the support forum of AppHarbor, and they have taken a screen shot of the error when they run it. It seems like it is something wrong with the routing since the StaticFile handler is

Minimum files needed to deploy webAPI server side

馋奶兔 提交于 2019-11-29 13:50:53
问题 So after a great deal of research I'm starting to enhance our service server stack with a webAPI entry point. Based on this thread, and especially the last post by a member of the Digerati board, we are implementing webAPI services as a facade into our WCF application layer. (Our WCF services are just facades into our Application layer where all of the behavior lives) My question is this. I downloaded MVC 4 and created a new WebAPI project in my service solution. But wow there was a ton of

WebApi with EF Code First generates error when having parent child relation

我的未来我决定 提交于 2019-11-29 06:13:14
I am breaking my head over this issue. I did find something on the internet about it, but not a clear answer. My problem: I have to classes in Model section of an MVC3 web app: ParentClass and ChildClass On ParentClass there is a property Children of type List I used EF Code First, which neatly generates a parent table and a child table for me in the database. Now I need a REST service that gives back a List or a single ParentClass. When I remove the property Children from the ParentClass there is no problem. But with the propoerty Children there I keep getting an error. Error: "The type

Web services API Keys and Ajax - Securing the Key

被刻印的时光 ゝ 提交于 2019-11-28 17:28:31
问题 This is probably a generic security question, but I thought I'd ask in the realm of what I'm developing. The scenario is: A web service (WCF Web Api) that uses an API Key to validate and tell me who the user is, and a mix of jQuery and application on the front ends. On the one hand, the traffic can be https so it cannot be inspected, but if I use the same key per user (say a guid), and I am using it in both then there's the chance it could be taken and someone could impersonate the user. If I

Dependency Injection in WebAPI with Castle Windsor

£可爱£侵袭症+ 提交于 2019-11-28 16:49:25
问题 I want to implement Dependency Injection in WebApi application using Castle Windsor. I have following sample code - Interface - public interface IWatch { { DateTime GetTime(); } } Following Watch class implements IWatch Interface - public class Watch:IWatch { public DateTime GetTime() { return DateTime.Now; } } WebApi Controller - WatchController as below - public class WatchController : ApiController { private readonly IWatch _watch; public WatchController() { _watch = new Watch(); } //http:

Difference between WCF, Web API, WCF REST and Web Service?

时光毁灭记忆、已成空白 提交于 2019-11-28 14:28:12
问题 What is difference between WCF and Web API and WCF REST and Web Service? Is WCF really so complicated that the webapi should be used? Whether WebApi can do all the work and do not take advantage of others? 回答1: The .Net framework has a number of technologies that allow you to create HTTP services such as Web Service, WCF and now Web API. There are a lot of articles over the internet which may describe to whom you should use. Web Service It is based on SOAP and return data in XML form. It

HttpClient authentication header not getting sent

≯℡__Kan透↙ 提交于 2019-11-28 08:16:38
I'm trying to use an HttpClient for a third-party service that requires basic HTTP authentication. I am using the AuthenticationHeaderValue . Here is what I've come up with so far: HttpRequestMessage<RequestType> request = new HttpRequestMessage<RequestType>( new RequestType("third-party-vendor-action"), MediaTypeHeaderValue.Parse("application/xml")); request.Headers.Authorization = new AuthenticationHeaderValue( "Basic", Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes( string.Format("{0}:{1}", "username", "password")))); var task = client.PostAsync(Uri, request.Content);

Return either xml or json from MVC web api based on request

流过昼夜 提交于 2019-11-28 04:32:27
Given the following webapiconfig; config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); and this controller; public class ProductsController : ApiController { Product[] _products = new Product[] { new Product { Id = 1, Name = "Tomato Soup", Category = "Groceries", Price = 1 }, new Product { Id = 2, Name = "Yo-yo", Category = "Toys", Price = 3.75M }, new Product { Id = 3, Name = "Hammer", Category = "Hardware", Price = 16.99M } }; public IEnumerable<Product> GetAllProducts() { return _products; } } Using the URL

C# WCF Web API + JSONP

喜夏-厌秋 提交于 2019-11-28 02:14:54
Is there an easy way to get JSONP working for the new WCF Web API rest services? I've tried this with no luck <standardEndpoints> <webHttpEndpoint> <standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true" defaultOutgoingResponseFormat ="Json" crossDomainScriptAccessEnabled="true"/> </webHttpEndpoint> </standardEndpoints> https://alexanderzeitler.com/articles/Look-Ma,-I-can-handle-JSONP-%28aka-Cross-Domain-JSON%29-with-WCF-Web-API-and-jQuery!/ Update: Latest WCF Web API bits ships with integrated JSONP support whereas usage is almost similar to the way described in

ASP.NET Web API binding with ninject

 ̄綄美尐妖づ 提交于 2019-11-27 09:50:57
问题 I have just installed the mvc4 rc update and I am trying to build an api application with little luck. I am using ninject but cant get my controllers to load. I keep getting an error Type 'Api.Controllers.ConsumerController' does not have a default constructor I am very new to mvc and using injection so please bear with me. I havent done anything special to the default binding that is created via nuget public static class NinjectWebCommon { private static readonly Bootstrapper bootstrapper =