缺少using指令或程序集引用? ASP.NET WCF

时间:2013-04-18 10:28:28

标签: asp.net wcf web-services

我在一个项目中有三个项目,一个是数据库层,第二个是WCF,第三个是使用这两个项目的主站点,所以我在调试时遇到错误

Error   203 'CIService.CIServiceClient' does not contain a definition for 'GetInventoryProjectDetailCompleted' and no extension method 'GetInventoryProjectDetailCompleted' accepting a first argument of type 'CIService.CIServiceClient' could be found (are you missing a using directive or an assembly reference?) G:\Design Scoring\InspectionEvaluation\ProjectDetails.aspx.cs   30  27  G:\Design Scoring\InspectionEvaluation\

在以下代码行中,

CIService.CIServiceClient svcClient = new CIService.CIServiceClient();
                svcClient.GetInventoryProjectDetailCompleted += new EventHandler<CIService.GetInventoryProjectDetailCompletedEventArgs>(svcClient_GetInventoryProjectDetailCompleted);
                svcClient.GetInventoryProjectDetailAsync(consultantId, projectId);

此代码来自主站点,它使用WCF服务方法“GetInventoryProjectDetailCompleted”我已经在主站点上添加了WCF参考,在网上检查它我得到了解决方案,在web.config文件中添加引用,如图所示,

<add assembly="System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

希望你的建议

由于

2 个答案:

答案 0 :(得分:0)

从这段代码:

 svcClient.GetInventoryProjectDetailCompleted += new EventHandler<CIService.GetInventoryProjectDetailCompletedEventArgs>(svcClient_GetInventoryProjectDetailCompleted);

似乎GetInventoryProjectDetailCompleted不是方法而是事件,不是吗?

可能你会发现这个异步调用有用的例子:

http://www.codeproject.com/Articles/91528/How-to-Call-WCF-Services-Synchronously-and-Asynchr

答案 1 :(得分:-2)

希望这会对你有所帮助

Line 10:          var currentYear = date.getFullYear();
Line 11: 
Line 12:          var txtPurchaseDate = '<%=txtPurchaseDate.ClientId %>';
Line 13: 
Line 14:          $('#' + txtPurchaseDate).datepicker({