未定义服务引用



我在vs中添加了一个wcf服务(SifService)引用到我的Kentico web应用程序中,我没有选择任何高级选项。我只是提供了wsdl地址,提供了一个名称空间(SifService),然后单击OK。服务引用似乎已成功添加。然而,当我试图创建客户端的实例,如下面的代码,VS说类型或名称空间"SifService"找不到。我们最近刚从肯提科8号升级到肯提科9号。同样的代码在肯提科8号代码分支中运行良好。这个问题只出现在肯提科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。

有时这是visual studio的错误,清理解决方案,构建,所以关闭visual studio并重新构建,对我来说它工作了几次!

最新更新