How to call an ApiController from another .net project?

﹥>﹥吖頭↗ 提交于 2019-12-25 01:49:21

问题


I have an Asp.net Mvc3 project and I have made a ApiController in it. Now I want to call the api in a windows application project. And I dont know how to config Global.asax or web.config file to approach this. And I dont know what would be the service reference url(If the ApiController name is Service and the method in it is UpdatePrice)?


回答1:


You have to make an HTTP request from the application to the WEBAPI action URL you want to access using HttpClient. WEBAPI is a REST based HTTP service, so you can access it only via HTTP unlike WCF on this context.

You can refer here for more information and code samples on this.



来源:https://stackoverflow.com/questions/26375923/how-to-call-an-apicontroller-from-another-net-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!