简体   繁体   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

I have a project consuming an ancient ASMX service. 我有一个项目正在使用古老的ASMX服务。 While sitting at .Net Framework 4.6.1, I can add a reference to the service and I get no issues. 坐在.Net Framework 4.6.1上时,我可以添加对服务的引用,但没有任何问题。 But once I upgrade the project to 4.7 or 4.7.x, I start getting this error(s): 但是,一旦我将项目升级到4.7或4.7.x,我就会开始遇到以下错误:

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

I get this on three types. 我得到三种类型的信息。 Apart from the error in code, here are the warnings I get if I try to remove and add the service or update existing: 除了代码中的错误外,如果尝试删除和添加服务或更新现有服务,还会收到以下警告:

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

I'm not able to figure this one out. 我无法弄清楚这一点。 If I google the warnings, there are pointers to update the app.config but no protocols are there for me to remove. 如果我搜索警告,则有指向更新app.config的指针,但是没有可删除的协议。 And I cannot find anything relatable if I search on the error. 如果我搜索错误,则找不到任何相关的内容。

I need to update to the latest framework v4.8. 我需要更新到最新的框架v4.8。

Any help is greatly appreciated. 任何帮助是极大的赞赏。

Have you tried to remove the service reference and add the service reference again? 您是否尝试删除服务参考并再次添加服务参考? This ancient service called XML web service other than WCF service. 这个古老的服务称为XML Web服务,而不是WCF服务。 The error typically indicates that there are ambiguous understanding with some class definitions during the compilation(the namespace issue of class), which seems to nothing with the issue. 该错误通常表明在编译期间(类的名称空间问题)对某些类定义存在不明确的理解,而对该问题似乎没有任何帮助。 Generally speaking, the XML web service is compatible with the high version DotNet framework. 一般来说,XML Web服务与高版本的DotNet框架兼容。 At least, I could not reproduce your problem on my side. 至少,我无法在我这一边重现您的问题。
Xml web service is obsolete. Xml Web服务已过时。 WCF created by BasicHttpBinding is well compatible with the traditional soap web service. 由BasicHttpBinding创建的WCF与传统的soap Web服务很好地兼容。 I suggest you re-construct your service project.Alternatively, Asp.net WebAPI could create modern web service, which is widely used on the internet. 我建议您重新构建服务项目。或者,Asp.net WebAPI可以创建现代的Web服务,该服务已在Internet上广泛使用。
Feel free to let me know if there is anything I can help with. 请随时告诉我是否有什么我可以帮助的。

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

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