C# 最佳重载方法匹配有一些无效参数Asp.net Wcf?

C# 最佳重载方法匹配有一些无效参数Asp.net Wcf?,c#,asp.net,wcf,web-services,C#,Asp.net,Wcf,Web Services,我收到错误“最佳重载方法匹配有一些无效参数” 我的密码是 System.Collections.Generic.List<ConsultantShares> consultantShareList = (Session["ProjectShare"] as List<ConsultantShares>); CIService.CIServiceClient client = new CIService.CIServiceClient();

我收到错误“最佳重载方法匹配有一些无效参数”

我的密码是

System.Collections.Generic.List<ConsultantShares> consultantShareList = (Session["ProjectShare"] as List<ConsultantShares>);
        CIService.CIServiceClient client = new CIService.CIServiceClient();
        client.GetConsultantScoreAsync(consultantShareList,this.txtProjectId.Text,this.ddlWorkClass.SelectedValue);
        client.GetConsultantScoreCompleted += new EventHandler<CIService.GetConsultantScoreCompletedEventArgs>(client_GetConsultantScoreCompleted);
CIService.InventoryProject invProject=新的CIService.InventoryProject()

在服务期间

 public InventoryProject GetInventoryProjectDetail(string consultantId, string projectId)
        {
            ProjectService prjService = new ProjectService();
            return prjService.GetInventoryProjectDetail(consultantId, projectId);
        }

 public List<InventoryProject> GetProjectsByConsultant(string consultantId, int currentPageNumber, int pageSize)
        {
            ProjectService prjService = new ProjectService();
            return prjService.GetProjectsByConsultant(consultantId, currentPageNumber, pageSize);
        }
public InventoryProject GetInventoryProjectDetail(字符串consultantId,字符串projectId)
{
ProjectService prjService=新的ProjectService();
返回prjService.GetInventoryProjectDetail(consultantId,projectId);
}
公共列表GetProjectsByConsultant(字符串consultantId、int currentPageNumber、int pageSize)
{
ProjectService prjService=新的ProjectService();
返回prjService.GetProjectsByConsultant(consultantId、currentPageNumber、pageSize);
}
虽然CIService是我的WCF服务,InventoryProject.datasource是databasemanager的另一个项目,其dll正在该WCF项目中使用,但为什么它不识别“InventoryProject”


希望得到您的帮助

您有两个选择。首先,在作为参数传递给方法之前,可以在数组上调用
.ToList()
,第二个选项是,可以在创建代理(添加服务引用)时定义默认集合类型


出现错误的原因是,在添加可能指定的服务引用时,
System.Collection.Generic.List
作为集合类型。您可以将其修改为数组

还有一件事我想问一下,我得到的错误是一样的it@testerJoe,确保您的web方法正在接受相同类型(列表或数组)中的参数。对于你们来说,通过proxy处理这个问题会更简单,我正在编辑带有错误的文章,就像我在同一个文件中使用参数一样type@testerJoe,如果您在web服务以及其他项目中有对项目的引用,请确保已选中“重用引用程序集中的类型”。它在同一屏幕上可用。这将使两个项目使用相同的程序集。我在引用的程序集中检查了重用类型,如上图所示,而我得到了更多的错误,我想告诉你们的是,有时它显示了这个错误,有时在我检查InventoryProject.databases时它没有显示。它是这样的,
namespace CIService

    {
        [GeneratedCode("System.ServiceModel", "4.0.0.0")]
        [DebuggerStepThrough]
        public class CIServiceClient : ClientBase<ICIService>, ICIService
        {
               public void GetConsultantScoreAsync(ConsultantShares[] cs, string targetProjectId, string workclass);
        public void GetConsultantScoreAsync(ConsultantShares[] cs, string targetProjectId, string workclass, object userState);
        }
    }
Error   30  The type or namespace name 'InventoryProject' does not exist in the namespace 'CIService' (are you missing an assembly reference?)  G:\Design Scoring\InspectionEvaluation\ProjectDetails.aspx.cs   108 23  G:\Design Scoring\InspectionEvaluation\
 public InventoryProject GetInventoryProjectDetail(string consultantId, string projectId)
        {
            ProjectService prjService = new ProjectService();
            return prjService.GetInventoryProjectDetail(consultantId, projectId);
        }

 public List<InventoryProject> GetProjectsByConsultant(string consultantId, int currentPageNumber, int pageSize)
        {
            ProjectService prjService = new ProjectService();
            return prjService.GetProjectsByConsultant(consultantId, currentPageNumber, pageSize);
        }