I am using .NET Core Console application to create web site and its child application like below
ServerManager serverManager = new ServerManager();
Site webSite = serverManager.Sites.Add("MywebSite", @"C:\MywebSite", 80);
webSite.Applications.Add("Child1","C:\MyChildApplication");
webSite.ServerAutoStart = true;
serverManager.CommitChanges();
However i am getting error
System.Exception: Invalid application path
at Microsoft.Web.Administration.Interop.IAppHostProperty.set_Value(Object value) at
Microsoft.Web.Administration.ConfigurationElement.SetAttributeValue(String attributeName, Object value) at
Microsoft.Web.Administration.ApplicationCollection.Add(String path, String physicalPath) at
IISHelper.CreateWebSites(Settings settings) in XXXXXXXXX\\IISHelper.cs:line 14 at
XXXX.Program.Main(String[] args) in XXXXXXXXX\\Program.cs:line 15
All applications need to have their paths starting with /
(a convention with little explanation, so simply follow it).
Thus, in your case, you should use /Child1
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.