1

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

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:binding详细信息:导入 wsdl:binding 所依赖的 wsdl:portType 时出错。wsdl:portType 的 XPath://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 时出错。wsdl:binding 的 XPath: //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/

4

1 回答 1

2

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

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

对话

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

于 2012-10-09T21:52:59.933 回答