首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >这个WCF错误是什么意思:“自定义工具警告:无法导入wsdl:portType”

这个WCF错误是什么意思:“自定义工具警告:无法导入wsdl:portType”
EN

Stack Overflow用户
提问于 2009-12-09 18:05:45
回答 10查看 90K关注 0票数 86

我在我的解决方案中创建了一个WCF服务库项目,并拥有对此项目的服务引用。我使用类库中的服务,因此除了类库之外,我还有来自WPF应用程序项目的引用。服务是直接设置的-只需更改即可获得异步服务功能。

一切都很正常--直到我想要更新我的服务引用。它失败了,所以我最终回滚并重试,但即使这样也失败了!因此-更新服务引用失败,而不对其进行任何更改。为什么?!

我得到的错误是这样的:

代码语言:javascript
复制
Custom tool error: Failed to generate code for the service reference 
'MyServiceReference'.  Please check other error and warning messages for details.   

该警告提供了更多信息:

代码语言:javascript
复制
Custom tool warning: 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 'Patient' in  
namespace 'http://schemas.datacontract.org/2004/07/MyApp.Model'. Need to exclude all but one of the 
following types. Only matching types can be valid references: 
"MyApp.Dashboard.MyServiceReference.Patient, Medski.Dashboard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" (matching)
"MyApp.Model.Patient, MyApp.Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" (matching)
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:portType[@name='ISomeService']

也有两个类似的警告说:

代码语言:javascript
复制
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://tempuri.org/']/wsdl:portType[@name='ISomeService']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:binding[@name='WSHttpBinding_ISomeService']  

同样适用于:

代码语言:javascript
复制
Custom tool warning: Cannot import wsdl:port .. 

我觉得这一切都令人困惑..除了通过服务引用获得的类之外,客户端仪表板上没有Patient类。那么这意味着什么呢?为什么它会突然出现呢?记住:我甚至没有改变任何东西!

现在,这个问题的解决方案是找到了here,但没有解释这意味着什么。因此,在服务的“配置服务引用”中,我取消选中“在引用的程序集中重用类型”复选框。重建现在一切正常,没有问题。但是我到底改变了什么呢?这会对我的应用程序产生影响吗?什么时候应该取消勾选呢?我确实想重用我在其上设置了DataContract的类型,但仅此而已。在没有检查的情况下,我还能访问那些吗?

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/1872865

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档