Publish to virtual directory issue


I am attempting to use Visual Studio 2015 to publish an ASP.NET Core application to a virtual directory on a WindowsServer 2012 R2 IIS site. I have all the latest bits, using Web Deploy 3.6. IIS application is configured properly with a no managed code app pool.

Publishing works fine if I publish to the root folder, but I cannot publish every application to a new site.

So in the .pubxml, <DeployIisAppPath>iissitename</DeployIisAppPath> works, but <DeployIisAppPath>iissitename/api</DeployIisAppPath> does not.

I have seen many examples while researching of including the virtual folder so it must be supported.

The error I'm receiving in the server event log is:


An unexpected error occurred while retrieving the login information.

Exception:System.Runtime.InteropServices.COMException (0x8007000D): Invalid site name

at Microsoft.Web.Administration.Interop.IAppHostProperty.set_Value(Object value) at Microsoft.Web.Administration.ConfigurationElementCollectionBase`1.FindElementWithCollectionKey(String elementName, String collectionKey, Object value) at Microsoft.Web.Administration.SiteCollection.get_Item(String name) at Microsoft.Web.Management.Server.ApplicationManagementUnit.EnsureDefinition() at Microsoft.Web.Management.Server.ApplicationManagementUnit..ctor(IManagementContext context, String siteName, String applicationPath) at Microsoft.Web.Management.Server.WebManagementHttpModule.CreateManagementUnit(HttpRequest request) at Microsoft.Web.Management.Server.WebManagementHttpModule.OnApplicationPostAuthorizeRequest(Object sender, EventArgs e)

Note that I have not been able to resolve this by changing the MSDeployPublishMethod to RemoteAgent

Any assistance would be greatly appreciated.

asked on Stack Overflow Sep 16, 2016 by Ian Elsinga • edited Jun 20, 2020 by Community

1 Answer


you have 2 web sites running pointing to the same Virtual directory and or one virtual directory is still on the old version. check all files in virtual directory - all web servers match App > Web same version.

answered on Stack Overflow Jun 6, 2019 by Jose

User contributions licensed under CC BY-SA 3.0