如何在MVC-4应用程序中使用wcf服务(已托管) [英] how to consume wcf services (hosted already) in MVC-4 application

查看:90
本文介绍了如何在MVC-4应用程序中使用wcf服务(已托管)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





如何在MVC-4应用程序中使用wcf服务(已托管)。

示例服务如: http://services.odata.org/Northwind/Northwind.svc [ ^ ]

推荐答案

您可以添加对MVC应用程序的服务引用,最终它会在您的应用程序中创建客户端。创建客户端的对象,您现在可以使用该服务了。



右键单击解决方案的Reference文件夹 - >添加服务参考 - >提供地址(在您的情况下 http://services.odata.org/Northwind/Northwind.svc/ [ ^ ]) - >去 - >提供所需的命名空间 - >好的。



现在在您的应用程序中创建服务引用。您现在可以使用它。
You can add the service reference to your MVC application, eventually it creates the Client in your app. Create the object to the client and you are now ready to consume the service.

Right click on the Reference folder of your solution -> Add Service Reference -> Provide the address ( in your case http://services.odata.org/Northwind/Northwind.svc/[^]) -> Go -> Give the required namespace -> Ok.

Now the service reference is created in your application. You can consume it now.


这篇关于如何在MVC-4应用程序中使用wcf服务(已托管)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆