servicestack,service-reference,Visual Studio 2010,Soap,Visual Studio 2012,servicestack,Service Reference" /> servicestack,service-reference,Visual Studio 2010,Soap,Visual Studio 2012,servicestack,Service Reference" />

Visual studio 2010 添加服务引用错误“;无法导入wsdl:portType";

Visual studio 2010 添加服务引用错误“;无法导入wsdl:portType";,visual-studio-2010,soap,visual-studio-2012,servicestack,service-reference,Visual Studio 2010,Soap,Visual Studio 2012,servicestack,Service Reference,我无法使VS 2010或2012中的Add Service引用适用于基于ServiceStack构建的web服务。我遵循了github上的方法,包括将ContractNameSpace属性添加到AssemblyInfo.cs文件中,并确保我的所有DTO都位于同一名称空间中,但运气不佳。相反,我收到了许多构建警告错误消息,我已经在下面介绍了这些消息 有人对出了什么问题有什么建议吗 Warning 1 Custom tool warning: Cannot import wsdl:portType

我无法使VS 2010或2012中的Add Service引用适用于基于ServiceStack构建的web服务。我遵循了github上的方法,包括将ContractNameSpace属性添加到AssemblyInfo.cs文件中,并确保我的所有DTO都位于同一名称空间中,但运气不佳。相反,我收到了许多构建警告错误消息,我已经在下面介绍了这些消息

有人对出了什么问题有什么建议吗

Warning 1 Custom tool warning: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: Schema with target namespace 'http://schemas.servicestack.net/types' could not be found.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:portType[@name='ISyncReply']

Warning 2 Custom tool warning: 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://schemas.servicestack.net/types']/wsdl:portType[@name='ISyncReply']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:binding[@name='WSHttpBinding_ISyncReply']

Warning 3 Custom tool warning: 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://schemas.servicestack.net/types']/wsdl:binding[@name='WSHttpBinding_ISyncReply']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:service[@name='SyncReply']/wsdl:port[@name='WSHttpBinding_ISyncReply']

Warning 4 Custom tool warning: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter
Error: Schema with target namespace 'http://schemas.servicestack.net/types' could not be found.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:portType[@name='IOneWay']

Warning 5 Custom tool warning: 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://schemas.servicestack.net/types']/wsdl:portType[@name='IOneWay']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:binding[@name='WSHttpBinding_IOneWay']

Warning 6 Custom tool warning: 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://schemas.servicestack.net/types']/wsdl:binding[@name='WSHttpBinding_IOneWay']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:service[@name='AsyncOneWay']/wsdl:port[@name='WSHttpBinding_IOneWay']

Warning 1 Custom tool warning: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: Schema with target namespace 'http://schemas.servicestack.net/types' could not be found.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:portType[@name='ISyncReply']

Warning 2 Custom tool warning: 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://schemas.servicestack.net/types']/wsdl:portType[@name='ISyncReply']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:binding[@name='WSHttpBinding_ISyncReply']

Warning 3 Custom tool warning: 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://schemas.servicestack.net/types']/wsdl:binding[@name='WSHttpBinding_ISyncReply']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:service[@name='SyncReply']/wsdl:port[@name='WSHttpBinding_ISyncReply']

Warning 4 Custom tool warning: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter
Error: Schema with target namespace 'http://schemas.servicestack.net/types' could not be found.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:portType[@name='IOneWay']

Warning 5 Custom tool warning: 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://schemas.servicestack.net/types']/wsdl:portType[@name='IOneWay']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:binding[@name='WSHttpBinding_IOneWay']

Warning 6 Custom tool warning: 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://schemas.servicestack.net/types']/wsdl:binding[@name='WSHttpBinding_IOneWay']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://schemas.servicestack.net/types']/wsdl:service[@name='AsyncOneWay']/wsdl:port[@name='WSHttpBinding_IOneWay']

我发现了问题的根源。我的一个DTO没有使用
[DataContract]
[DataMember]
属性装饰

这意味着ServiceStack生成的WSDL不包含此DTO的类型信息,因此当WSDL的某个消息子节引用此DTO类型时,VS找不到它并引发异常


希望这能帮助其他人。我花了相当长的时间才弄明白我做错了什么。

另一个原因可能是:检查targetNamespace是否可能产生冲突,删除tempuri.org的任何实例-适当地放置一致的命名空间,将解决上述错误

targetNamespace='http://tempuri.org/']/wsdl:portType[@name='IMyInterafaceService' 

希望能有所帮助

在服务引用配置帮助中禁用“引用程序集中的重用类型”是否有帮助?欢迎使用,请使用评论部分留下问题我也很难回答这个问题,虽然我的DTO上有datacontract和datamember属性,但我已经让它们非常简单,可以让它正常工作,仍然像你的一样崩溃above@Ozz最好是为您的问题创建一个单独的问题,包括测试代码。完成此操作后,我可以查看一下,看看是否可以确定问题的原因。是的,这已在at
中列出。确保DTO对象具有[DataContract]属性…
使用
tempuri.org
,只要使用一致,就没有本质上的问题。