2012-10-09 30 views
1

我真的陷入了一种情况,并试图在部分中解释它。在类库项目中添加WCF服务引用,并在使用该类库的Web站点中添加相同的WEF引用。

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

2:我有一个类库项目。

3:我有一个Web站点使用类库项目。

4:类库有来自WCF类库项目,并同WCF refrence服务引用添加到网站,以及

5:当我建立的网站下面的错误出现。

Error 1113 Reference.svcmap: Failed to generate code for the service reference 'VPServices'. Cannot import wsdl:portType Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter Error: List of referenced types contains more than one type with data contract name 'VpResponseData' in namespace 'http://schemas.datacontract.org/2004/07/VPExternalCalls.CoreApi.MessageDefinitions'. Need to exclude all but one of the following types. Only matching types can be valid references:

"WebApplication.Helpers.Class.ResponseData, WebApplication.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" (matching) "VPExternalCalls.CoreApi.MessageDefinitions.VpResponseData, VPExternalCalls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=559d4289d6c6d138" (matching) XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:portType[@name='IVPServices'] Cannot import wsdl:binding Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on. XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:portType[@name='IVPServices'] XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:binding[@name='BasicHttpBinding_IVPServices'] Cannot import wsdl:port Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on. XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:binding[@name='BasicHttpBinding_IVPServices'] XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:service[@name='VPServices']/wsdl:port[@name='BasicHttpBinding_IVPServices'] App_WebReferences/VPServices/

回答

2

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

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

Dialog

这样做对两个服务引用,重新编译,看看是否能解决问题,如果你发现你需要一些的引用类型,你需要使用'指定程序集中的重用类型'重新启用它们,但是通常你可以使用服务引用没有重新使用任何引用类型。

相关问题