【问题标题】:Adding WCF Service refrence in Class library project, and Adding the Same WEF refrence in Web site consuming that class library.在类库项目中添加 WCF 服务引用,并在使用该类库的网站中添加相同的 WCF 引用。
【发布时间】:2012-09-30 00:23:54
【问题描述】:

我真的陷入了困境,并会尝试部分解释它。

1:我有一个包含一些服务的 WCF 类库项目。

2:我有一个类库项目。

3:我有一个使用类库项目的网站。

4:类库有一个来自 WCF 类库项目的服务引用,并且同样的 WCF 引用也添加到了网站

5:当我建立网站时,出现以下错误。

错误 1113 Reference.svcmap:无法为服务引用“VPServices”生成代码。无法导入 wsdl:portType 详细信息:运行 WSDL 导入扩展时引发异常:System.ServiceModel.Description.DataContractSerializerMessageContractImporter 错误:引用类型列表包含命名空间“http://”中具有数据协定名称“VpResponseData”的多个类型schemas.datacontract.org/2004/07/VPExternalCalls.CoreApi.MessageDefinitions'。需要排除除以下类型之一之外的所有类型。只有匹配的类型可以是有效的引用:

"WebApplication.Helpers.Class.ResponseData, WebApplication.Helpers, 版本=1.0.0.0,文化=中性,PublicKeyToken=null"(匹配) “VPExternalCalls.CoreApi.MessageDefinitions.VpResponseData, VPExternalCalls,版本=1.0.0.0,文化=中性, PublicKeyToken=559d4289d6c6d138"(匹配)XPath 到错误源: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:portType[@name='IVPServices'] 无法导入 wsdl:绑定详细信息:导入一个错误 wsdl:binding 所依赖的 wsdl:portType。 XPath 到 wsdl:端口类型: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:portType[@name='IVPServices'] 错误源的 XPath: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:binding[@name='BasicHttpBinding_IVPServices'] 无法导入 wsdl:port 详细信息:导入一个错误 wsdl:port 所依赖的 wsdl:binding。 XPath 到 wsdl:绑定: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:binding[@name='BasicHttpBinding_IVPServices'] 错误源的 XPath: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:service[@name='VPServices']/wsdl:port[@name='BasicHttpBinding_IVPServices'] App_WebReferences/VPServices/

【问题讨论】:

    标签: c# wcf web-services class-library


    【解决方案1】:

    我遇到过类似的错误,我首选的解决方案是完全摆脱服务引用并编写自己的简单代理客户端。

    如果您必须继续使用导入服务引用,您可以尝试以下操作:在服务引用导入对话框中,单击高级按钮(或右键单击现有引用并从上下文菜单中选择“配置服务引用”。在高级属性对话框,取消选中“在引用程序集中重用类型”框:

    对两个服务引用执行此操作,重新编译,看看是否能解决问题。如果您发现需要某些引用类型,则需要使用“在指定程序集中重用类型”有选择地重新启用它们,但通常您可以在不重用任何引用类型的情况下使用服务引用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多