gpt4 book ai didi

wpf - 此 WCF 错误 : "Custom tool warning: Cannot import wsdl:portType" 是什么意思

转载 作者:行者123 更新时间:2023-12-03 05:07:39 26 4
gpt4 key购买 nike

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

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

我得到的错误是这个:

Custom tool error: Failed to generate code for the service reference 
'MyServiceReference'. Please check other error and warning messages for details.

警告提供了更多信息:

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']

还有两个类似的警告:

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']

同样的:

Custom tool warning: Cannot import wsdl:port .. 

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

现在,找到了解决方案here ,但没有解释这意味着什么。所以;在服务的“配置服务引用”中,取消选中“重用引用的程序集中的类型”复选框。现在重建一切正常,没有问题。但我真正改变了什么?这会对我的申请产生影响吗?什么时候应该取消选中此选项?我确实想重用已设置 DataContract 的类型,但仅此而已。如果没有经过此检查,我仍然可以访问那些内容吗?

最佳答案

我在这里找到了答案:http://www.lukepuplett.com/2010/07/note-to-self-don-let-wcf-svcutil-reuse.html

长话短说:我从高级菜单中取消选中在引用程序集中重用类型

<小时/>

我不知道这是否重要,但我没有使用 MVC,而是使用 Web 表单。

关于wpf - 此 WCF 错误 : "Custom tool warning: Cannot import wsdl:portType" 是什么意思,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1872865/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com