What does this WCF error mean: “Custom tool warning: Cannot import wsdl:portType”

后端 未结 13 1822
难免孤独
难免孤独 2020-11-29 17:38

I created a WCF service library project in my solution, and have service references to this. I use the services from a class library, so I have references from my WPF applic

13条回答
  •  孤独总比滥情好
    2020-11-29 18:31

    If in doubt that your service doesn't have any problems (such as problems with enums, or non-serializable classes as mentioned by others) then try to create a new project with a new reference.

    I am using Silverlight 5 and I had tried to delete and recreate the reference several times. The reference.cs file just came up completely empty each time and it had been literally years since I'd created it so trying to figure out what had changed in the service was out of the question.

    I noticed that the error contained references to 2.0.5.0. Now I don't even know if this is actually relevant to the Silverlight version, but it made me think of just creating a brand new project and then suddenly everything worked.

    Warning 2 Custom tool warning: Cannot import wsdl:portType Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter Error: Could not load file or assembly 'System.Xml, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified. XPath to Error Source: //wsdl:definitions[@targetNamespace='']/wsdl:port Type[@name='IShoppingCart']

提交回复
热议问题