2017-06-04 110 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中添加这些节点。

相关问题