【发布时间】:2013-05-02 08:41:16
【问题描述】:
我的 wcf 应用程序 IService1.cs 中有这样的类和接口
[ServiceContract]
public interface IService1
{
[OperationContract]
string insertValues(empInfo objInfo);
}
[DataContract]
public class empInfo
{
string _organizationName = string.Empty;
string _organizationAddr = string.Empty;
int? _totalemp;
}
在 Service1.svc.cs 中,我已经实现了该接口。
public class Service1 : IService1
{
public string insertValues(empInfo objInfo)
{
.....
}
}
然后我创建了一个空的 mvc4 客户端应用程序来使用这个 wcf 服务。
我已经添加了 ServiceReference,现在它作为 ServiceReference1 出现在服务参考文件夹中。然后我这样做了
1. 创建了一个名为 Defalut1controller 的控制器。
2.在这个控制器中,我尝试添加以下行
ServiceReference1.Service1Client proxy = new ServiceReference1.Service1Client();
在 ActionResult 中。但无法获取 ServiceReference1 字。
当我像这样更新我的服务时出现它的 (ServiceReference1)
发件人 - string insertValues(empInfo objInfo); - 收件人 - string insertValues(string objInfo);
现在我已经构建了这个 wcf 应用程序,并在我的客户端 mvc4 应用程序中更新了服务引用。现在的
ServiceReference1.Service1Client proxy = new ServiceReference1.Service1Client();
线路已启用。
我已经尝试使用 .net web 应用程序来使用相同的内容,我可以毫无问题地做,我错过了 mvc4,请帮助。提前谢谢..
【问题讨论】:
标签: asp.net-mvc wcf asp.net-mvc-4