Reputation: 34129
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
Upvotes: 1
Views: 581
Reputation: 63264
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
.
Upvotes: 4