簡體   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