I have an Azure Web App that has a default app in site\wwwroot. Now i want to create a virtual application in it, like this:
Virtual Path: / ; Physical Path: site\wwwroot ; Type: Application
Virtual Path: /feature ; Physical Path: site\wwwroot\feature ; Type: Application
As you can see, i already created the virtual application with the paths, the folder exists and has its own web.config and everything.
BUT when i go to my website like this: [URL]/feature it loads with all the configurations of the root application. It looks like the virtual application only exists to be able to find the original application with another URL.
How can I have my virtual application use its own web.config and files as a feature branch should? It is part of our release, so it should be automatically created like the principals of the continous deployment say.
I'm expecting to use the virtual applications files as I got the to subURL but instead it uses the root files.
How can I have my virtual application use its own web.config and files as a feature branch should?
Web.config
file, check the SOThread which I have answered on how to deploy Virtual Applications.web.config
file, as we create it from Azure Portal.Only config available will be from the Virtual App folder. Even if you deploy Multiple Virtual Apps, the web.config
will be accessible only for that particular folder.
To make sure the configurations are loading from the Virtual App, Check the below Workaround to retrieve App Settings Configuration values in Virtual Application.
I have given workaround for .NET Framework Application. If you are working with .NET Core, follow the same steps.
Web.config
from Virtual App:
<appSettings>
<add key="ConfigValue" value="Value from Feature App"/>
</appSettings>
Code to retrieve App Setting
if (!IsPostBack)
{
DataBind();
}
string configval = ConfigurationManager.AppSettings["ConfigValue"];
code in .aspx page:
<h3><%# ConfigurationManager.AppSettings["ConfigValue"] %></h3>
Output:
Default App:
Virtual Application: