1
votes

I am really stuck up in a situation and will try to explain it in parts.

1: I have a WCF Class library project having some services.

2: I have a Class library project.

3: I have a Web Site consuming the class library project.

4: The Class library has a service reference from WCF class library project and same WCF refrence is added to Web site as well

5: When i build the website the following error comes up.

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/

1

1 Answers

2
votes

I've experienced a similar error, and my preferred solution is to get rid of the service reference altogether and write your own simple proxy client.

If you must stay with import service reference, you can try this: in the service reference import dialogue, click the advanced button (or right-click your existing reference and choose 'configure service reference' from the context menu. In the advanced properties dialog, uncheck the box that says 'Reuse types in references assemblies':

Dialog

Do this for both service references, recompile, and see if that fixes the issue. If you find you need some of the referenced types, you will need to re-enable them selectively using 'Reuse types in specified assemblies', but often you can employ a service reference without Re-using any of the referenced types.