本文介绍了任何方式来产生一个的WebAPI项目C#包装的HTTPClient?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们正在使用ASP.NET的WebAPI 2公开的服务功能,我们两个网站和浏览器客户端即将开展的项目。

In an upcoming project we are looking to use ASP.NET WebAPI 2 to expose service functionality to both our web sites and browser clients.

由于我们要尽可能少终点尽可能在可能的情况,我们希望所有的呼叫,即使内部从的WebAPI Web服务消耗我们的服务器。 (即不只是新ING一个控制器实例直接)

Since we want as few "end-points" as possible where possible we want all calls, even "internal" to consume our servers from the WebAPI web services. (i.e. not just new-ing up a controller instance directly)

我要寻找的东西来帮助生成或支架C#客户即包HttpClient的,并提供强类型代理的。 。类似WCF时产生代理的通过添加新的服务引用

I am looking for something to help generate or scaffold C# "client's" that wrap the HTTPClient and deliver strongly typed "proxy's". Similar to WCF when generating proxy's via "Add new service reference".

我看了问类似的事情(如所看到的) ,但想请不相关的MVC或测试的担忧更直接的问题。

I have read other questions asking similar things (As seen HERE), but wanted to ask a more direct question not related to MVC or testing concerns.

推荐答案

这是最好的表现是我一直在寻找:

This is the best representation of what I was looking for:


希望这会在问世官方的方式更高版本。

Hope this might come out in an official way later.

这篇关于任何方式来产生一个的WebAPI项目C#包装的HTTPClient?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 10:42