Showing posts with label HTTP. Show all posts
Showing posts with label HTTP. Show all posts

Friday, August 24, 2012

Microsoft Release New REST API Framework as Part of .NET 4.5


As part of the recent Visual Studio 2012 and .NET 4.5 launch, Microsoft formally unveiled its new web services framework called the ASP.NET Web API. Included as part of the ASP.NET MVC 4 offering, the open-source ASP.NET Web API is designed to simplify the development and consumption of RESTful services.

In a post called “Where does ASP.NET Web API Fit?”, Rick Strahl of West Wind Technologies explains the purpose and benefits of the ASP.NET Web API.

ASP.NET Web API differentiates itself from the previous Microsoft in-box HTTP service solutions in that it was built from the ground up around the HTTP protocol and its messaging semantics. Unlike WCF REST or ASP.NET AJAX with ASMX, it’s a brand new platform rather than bolted on technology that is supposed to work in the context of an existing framework. The strength of the new ASP.NET Web API is that it combines the best features of the platforms that came before it, to provide a comprehensive and very usable HTTP platform. Because it's based on ASP.NET and borrows a lot of concepts from ASP.NET MVC, Web API should be immediately familiar and comfortable to most ASP.NET developers.

Strahl points out the core capabilities that make the ASP.NET Web API a natural fit for both existing users of the the ASP.NET MVC framework, and developers who need to build HTTP endpoints.

Strong Support for URL Routing to produce clean URLs using familiar MVC style routing semantics
Content Negotiation based on Accept headers for request and response serialization
Support for a host of supported output formats including JSON, XML, ATOM
Strong default support for REST semantics but they are optional
Easily extensible Formatter support to add new input/output types
Deep support for more advanced HTTP features via HttpResponseMessage and HttpRequestMessage
classes and strongly typed Enums to describe many HTTP operations
Convention based design that drives you into doing the right thing for HTTP Services
Very extensible, based on MVC like extensibility model of Formatters and Filters
Self-hostable in non-Web applications
Testable using testing concepts similar to MVC
Microsoft already has an existing a web services framework called Windows Communication Foundation (WCF) which lets developers build contract-first services that leverage transport protocols such as TCP, HTTP and MSMQ. Originally built for SOAP-based services that want WS-* capabilities, WCF eventually added a handful of REST-friendly capabilities. While the ASP.NET Web APIs were initially aligned to the WCF framework, they were eventually shuffled over to the ASP.NET team as described in a Code Project article by Web developer Ido Flatow.

As time passed, the WCF Web APIs had a lot of trouble adapting WCF to the “native” HTTP world. As WCF was primarily designed for SOAP-based XML messages, and the “open-heart” surgery that was required to make the Web API work as part of WCF was a bit too much (or so I understand from people who were involved in creating the Web APIs). On the other hand, the ASP.NET MVC infrastructure with its elegant handling of HTTP requests and responses, and its support of easy-to-create controllers seemed like the proper way to go for creating this new type of services.

WCF remains alive and well in the latest .NET 4.5 release and Flatow identifies some of the decision criteria for choosing between WCF and the ASP.NET Web API.

If your intention is to create services that support special scenarios – one way messaging, message queues, duplex communication etc, then you’re better of picking WCF
If you want to create services that can use fast transport channels when available, such as TCP, Named Pipes, or maybe even UDP (in WCF 4.5), and you also want to support HTTP when all other transports are unavailable, then you’re better off with WCF and using both SOAP-based bindings and the WebHttp binding.
If you want to create resource-oriented services over HTTP that can use the full features of HTTP – define cache control for browsers, versioning and concurrency using ETags, pass various content types such as images, documents, HTML pages etc., use URI templates to include Task URIs in your responses, then the new Web APIs are the best choice for you.
If you want to create a multi-target service that can be used as both resource-oriented service over HTTP and as RPC-style SOAP service over TCP – talk to me first, so I’ll give you some pointers.
The ASP.NET Web API is included in Visual Studio 2012 and is also available as a download for Visual Studio 2010 users. Developers looking to get started with the framework will find many example projects available on the team’s Codeplex site.

Friday, July 13, 2012

Red Gate Software Releases ANTS Performance Profiler 7.3, First Profiler to Join the Dots Behind ASP.NET Performance Problems


Profiles .NET code performance alongside database calls and shows which HTTP request triggered each piece of code



Red Gate Software has released ANTS Performance Profiler 7.3, the first profiler to tie together code performance, database performance, and HTTP requests.

In a single view, the tool allows ASP.NET developers to relate poor performance in their application to specific lines of code and database requests, and check which of the two is causing the problem.

"Developers usually have to jump between profilers to see everything that's happening in an ASP.NET application," says Elizabeth Ayer, Product Manager at Red Gate.

"ANTS Performance Profiler 7.3 puts a stop to that. You get everything in one place, making it much simpler and quicker to diagnose and fix problems."

Grouping .NET code and database calls by HTTP request provides a picture of everything that happens in the code when a specific activity, such as a search, takes place in an application.

The profiler provides hit counts and timings for each piece of code and database call, so users can see where most time is being spent, and which areas of their application may need optimization.

The ability to see in one view how database queries are called from your .NET code is a unique feature among .NET profilers. ANTS Performance Profiler currently supports local, remote, and cloud-based SQL Server and Oracle databases.

"It's an excellent piece of engineering. I was amazed to see how easily we were able to optimize messaging speed from 1200 messages per second to 5700," says Pushpraj Rahul, a user of the Early Access Program.

"As a long time user, I've integrated the profiler into my entire development process. It has truly helped us write better performing applications from the beginning. The recent release with exposure to SQL statements makes that even more true," says Mitchel Sellers, a Microsoft C# MVP and CEO of IowaComputerGurus.

Free trial available

Developers can try the latest release for themselves with a 14-day free trial, available from www.red-gate.com/antsperformanceprofiler