简体   繁体   English

在MVC 4中使用WCF服务

[英]Consuming WCF Service in MVC 4

I have created a WCF Service which I'm consuming in MVC3 application. 我创建了在MVC3应用程序中使用的WCF服务。 Now I have a new project of MVC4 in which I want to consume the same service, but I'm not getting the Service class for creating the object. 现在,我有一个新的MVC4项目,我想在其中使用相同的服务,但没有获得用于创建对象的Service类。

ServiceReference1.Service1Client obj = new ServiceReference1.Service1Client();

This line is giving me error. 这行给我错误。 My MVC4 project is completely new with Empty template in which I have added a controller and trying to access the service class in it. 我的MVC4项目是一个全新的Empty模板,在其中添加了一个控制器并尝试访问其中的服务类。

Try this. 尝试这个。

http://www.naveenbhat.in/2013/07/mvc-4-wcf-add-service-reference.html http://www.naveenbhat.in/2013/07/mvc-4-wcf-add-service-reference.html

Hope this helps. 希望这可以帮助。

Seems some update is missing with the VS. VS似乎缺少一些更新。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM