Stop Web Configuration Inheritence with Azure Virtual Web Application

拥有回忆 提交于 2019-12-13 06:11:58

问题


I have created a web application project and deployed it to Azure.

In the web.config file for this application, a number of <assembly> elements appear in the <system.web><compilation> element. Specifically, these assembly entries point to DevExpress assemblies but they could really be anything.

I have also created a Web API project that is deployed as a virtual application under the web application. It looks like the <assembly> entries are being inherited from the configuration of the web application. The Web API project does not use these assemblies and throws an exception stating that they cannot be loaded.

As a temporary workaround, I have manually copied over the assemblies to the bin folder of the Web API application. However, this is not a permanent solution.

I have tried clearing the assembly entries in the Web API configuration (using the <clear /> element). I have also tried removing the entries (using the <remove> element). Neither of these worked.

What is the best way to stop this inheritance form occurring?


回答1:


As mentioned in this official document about ASP.NET Configuration File Hierarchy and Inheritance:

ASP.NET application root directory > Web.config

The Web.config file for a specific ASP.NET application is located in the root directory of the application and contains settings that apply to the Web application and inherit downward through all of the sub directories in its branch.

ASP.NET application subdirectory > Web.config

The Web.config file for an application subdirectory contains settings that apply to this subdirectory and inherit downward through all of the subdirectories in its branch.

I assumed that you could leverage Location Settings to achieve your purpose. Also, there is a blog about Settings and Virtual Directory Inheritance, you could refer to it.



来源:https://stackoverflow.com/questions/41286281/stop-web-configuration-inheritence-with-azure-virtual-web-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!