2016-10-17 58 views
0

我已經在VS中爲我的Kentico Web應用程序添加了一個wcf服務(SifService)引用。我沒有選擇任何高級選項。我剛剛提供了wsdl地址,提供了一個名稱空間(SifService)並單擊確定。服務參考似乎已成功添加。但是,當我嘗試像下面的代碼中那樣創建客戶端實例時,VS說無法找到類型或命名空間「SifService」。我們剛剛從Kentico 8升級到了Kentico 9.同樣的確切代碼在Kentico 8代碼分支中運行良好。該問題僅出現在Kentico 9分支中。未定義服務引用

var sifClient = new SifService.SifClient(); 

當我試圖運行在VS的網站,我得到在瀏覽器這個錯誤:

Parser Error 

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

Parser Error Message: Reference.svcmap: Could not load file or assembly 'System.Web.Http, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) 


Source Error: 


[No relevant source lines] 

Source File: /App_WebReferences/SifService/ Line: 1 

Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.Http, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded. 

注:一切都正常運行,直到我添加服務引用SifService。

回答

0

有時候這是Visual studio的錯誤,清理解決方案,構建,關閉視覺工作室並重新構建,對我來說它工作了幾次!

+0

已經嘗試過。謝謝 – ihatemash