繁体   English   中英

将项目从.Net 4.6.1升级到4.7.x会导致WCF Reference.cs中出现错误

[英]Upgrading projects from .Net 4.6.1 to 4.7.x causes errors in WCF Reference.cs

我有一个项目正在使用古老的ASMX服务。 坐在.Net Framework 4.6.1上时,我可以添加对服务的引用,但没有任何问题。 但是,一旦我将项目升级到4.7或4.7.x,我就会开始遇到以下错误:

'FlightSchedule': member names cannot be the same as their enclosing type

我得到三种类型的信息。 除了代码中的错误外,如果尝试删除和添加服务或更新现有服务,还会收到以下警告:

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://tempuri.org/']/wsdl:binding[@name='DIAFlightScheduleHttpGet']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:service[@name='DIAFlightSchedule']/wsdl:port[@name='DIAFlightScheduleHttpGet']
D:\Projects\...\Connected Services\FISAirline\Reference.svcmap  1

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://tempuri.org/']/wsdl:binding[@name='DIAFlightScheduleHttpPost']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:service[@name='DIAFlightSchedule']/wsdl:port[@name='DIAFlightScheduleHttpPost']
D:\Projects\...\Connected Services\FISAirline\Reference.svcmap  1

Custom tool warning: Cannot import wsdl:binding
Detail: The required WSDL extension element 'binding' from namespace 'http://schemas.xmlsoap.org/wsdl/http/' was not handled.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:binding[@name='DIAFlightScheduleHttpGet']
D:\Projects\...\Connected Services\FISAirline\Reference.svcmap  1

Custom tool warning: Cannot import wsdl:binding
Detail: The required WSDL extension element 'binding' from namespace 'http://schemas.xmlsoap.org/wsdl/http/' was not handled.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:binding[@name='DIAFlightScheduleHttpPost']
D:\Projects\...\Connected Services\FISAirline\Reference.svcmap  1

我无法弄清楚这一点。 如果我搜索警告,则有指向更新app.config的指针,但是没有可删除的协议。 如果我搜索错误,则找不到任何相关的内容。

我需要更新到最新的框架v4.8。

任何帮助是极大的赞赏。

您是否尝试删除服务参考并再次添加服务参考? 这个古老的服务称为XML Web服务,而不是WCF服务。 该错误通常表明在编译期间(类的名称空间问题)对某些类定义存在不明确的理解,而对该问题似乎没有任何帮助。 一般来说,XML Web服务与高版本的DotNet框架兼容。 至少,我无法在我这一边重现您的问题。
Xml Web服务已过时。 由BasicHttpBinding创建的WCF与传统的soap Web服务很好地兼容。 我建议您重新构建服务项目。或者,Asp.net WebAPI可以创建现代的Web服务,该服务已在Internet上广泛使用。
请随时告诉我是否有什么我可以帮助的。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM