2017-06-04 297 views
0

我有一個現有的網站設置和工作(kentico 10),我想使用虛擬目錄將Web API添加到它。將Web API添加到帶有虛擬目錄的現有應用程序

我設置了web api項目,它在我將IIS映射爲正常站點時起作用。但是,當我將該文件夾映射爲虛擬目錄並將其轉換爲我的kentico網站時,出現錯誤。我不明白的是爲什麼我收到來自kentico web配置發起,而不是新的Web API的web.config /服務錯誤:

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

Compiler Error Message: CS0234: The type or namespace name 'Web' does not exist in the namespace 'CMS.Base' (are you missing an assembly reference?) 

Source Error: 


Line 47:  <namespaces> 
Line 48:   <add namespace="CMS.Helpers" /> 
Line 49:   <add namespace="CMS.Base.Web.UI" /> 
Line 50:  </namespaces> 
Line 51:  </pages> 

我也嘗試添加這些DLL到Web API項目的bin其中停止了這個錯誤,但我無法從web-api項目中的kentico中按預期檢索數據。

感謝

回答

0

每當你在IIS中創建一個網站內的應用程序,父的web.config將由副應用非常相似,主要網站,如何繼承了「全局」 web.config中被繼承。也許不是所有的節點都會被繼承,但很多節點都會被繼承。

因此,您要做的就是將節點添加到您想要在新創建的子應用程序的web.config中刪除名稱空間等的區域(即:<remove name="WebDAVModule" />)。我不能具體說明哪些節點需要使用這些節點,但試驗和錯誤應該有所幫助。如果你按照屏幕上顯示的錯誤,他們應該幫助在你的子web.config中添加這些節點。

相關問題