Portable HTTP client for. net

Source: Internet
Author: User

Until recently, one of the questions about code sharing between. net, Silverlight, Windows Phone, and Windows Store was still the lack of the ability to initiate HTTP requests. Each Framework supports one or more HTTP clients, but they are not compatible with each other at the API level.

To solve this problem, developers can create their own platform-related adapters and add them to a required portable library using dependency injection. Basically, this is exactly what the new httpclient can be transplanted.

Of course, each version of httpclienthandler has different feature sets. Therefore, to expose more functions as much as possible, you can port the HTTP client to introduce extension methods such as supportsuseproxy and supportsallowautoredirect.

Immo landwerth explains:

If developers want to know why we add extension methods instead of general attributes: Some Microsoft. NET. Http support platforms have provided and are using the httpclienthandler class. Because the built-in version of the attribute cannot be directly modified, we have added the extension method and released it as an independent Assembly through the nuget package.

For the following reasons, Microsoft is becoming more and more popular with small and out-of-band release similar to the portable httpclient:

First, it builds a bridge to bridge the gap between our released platforms. Httpclient is a good example. It also supports async and await keywords. The out-of-band release feature allows us to release new features for multiple platforms through a single portable class library without waiting for any of the platforms to add this feature.

Secondly, our goal is to enhance the feedback loop between customers. In the past, we released "large" Beta versions, such as the beta version of the entire. NET Framework. This method certainly has its advantages, but we have also discovered its problems. The biggest drawback is that the release of the "large" beta version is expensive, and it is generally very close to RTM, which means that we cannot make major changes. In fact, we must reject a large number of bug reports in "large" Beta versions, because they only affect relatively small customers, or because fixing these bugs puts the RTM version at risk. Of course we are not the first company to encounter this problem; in this industry, the entire Agile Software Development movement is focused on this. Although I don't want to start philosophical discussions on Agile methodologies, it is difficult to deny that early release and frequent release are helpful for the feedback loop.

Some developers' expected features are not included in this candidate release, and the most important of which is the support for automatic decompression. In order not to delay this release, this feature will be available in subsequent versions after completion.

To support async/await on older platforms such as Silverlight, You can port httpclient dependent on the Bcl portability package.

Related Articles:

Portable httpclient for. NET Framework and Windows Phone

GET/httpclient/RTM-200 OK

13th-week nuget package-portable httpclient makes portable libraries easier to use

Cfnetwork-powered httpclient

Google API. Net portable class library 1.4.0 Beta Release

View Original English text:A portable HTTP client for. net

View Original Chinese text:Portable HTTP client for. net

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.