VS.NET 2015 ENT Web Deploy ASP.NET Core 1 error ERROR_USER_UNAUTHORIZED?
Asked Answered
M

1

9

I have set a web deploy on a local Windows 2012 server with a new Site.

I have set permissions to Administrator at IIS server level and at the Site level thru IIS Manager Permissions.

I have created an Application Pool and a Virtual Directory for MySiteApp.

My Web Deploy publish settings at VS.NET 2015:

Server: 192.168.45.60 Site name: TestSite/MySiteApp User name: TESTSERVER\Administrator

Validate Connection on publish profile pass ok.

Added True to .pubxml

When trying to Publish to server I am receiving the error:

Error Error: The remote server returned an error: (401) Unauthorized. Error Code: ERROR_USER_UNAUTHORIZED

At Windows Server 2012 event viewer I can see this error:

IISWMSVC_LOGIN_UNKNOWN_ERROR

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)

Process:WMSvc User=TESTSERVER\Administrator

If I am changing at .pubxml as follows:

<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod> to

<MSDeployPublishMethod>RemoteAgent</MSDeployPublishMethod>

and add <AuthType>NTLM</AuthType>

then I am able to publish with no problems.

I guess something I did not setup correctly for publishing with WMSVC.

Thanks for any help.

Asaf

Misanthrope answered 5/7, 2016 at 6:23 Comment(1)
I'm having this same exact problem. Did you ever get an answer as to why publishing with WMSVC doesn't work?Clarkin
I
1

I found that the Powershell script for .NET core was messing up the site URL. It was appending the publish site to the server URL but also including it in the destinationmanifest.xml file it was generating, so in effect it was trying to publish e.g. to "my_site/my_app" on "my_server" as "https://my_server:8172/msdeploy.axd?site=my_site/my_site/my_app".

I read through the new publish-module.psm1 script and found that there's an attribute for the publish profile that keeps it from doing this duplication.

<UseMSDeployServiceURLAsIs>True</UseMSDeployServiceURLAsIs>

Others had reported they had to include the following, but I didn't (although our server does have a signed certificate for WMSVC, ymmv):

    <AllowUntrustedCertificate>True</AllowUntrustedCertificate>
    <AuthType>NTLM</AuthType>

Ultimately my (rinsed) .pubxml file looks like:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>MSDeploy</WebPublishMethod>
    <ADUsesOwinOrOpenIdConnect>False</ADUsesOwinOrOpenIdConnect>
    <LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish />
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <PublishFramework>netcoreapp1.1</PublishFramework>
    <UsePowerShell>True</UsePowerShell>
    <EnableMSDeployAppOffline>True</EnableMSDeployAppOffline>
    <MSDeployServiceURL>https://MYSERVER:8172/msdeploy.axd</MSDeployServiceURL>
    <DeployIisAppPath>MYSITE/MYAPP</DeployIisAppPath>
    <RemoteSitePhysicalPath />
    <SkipExtraFilesOnServer>True</SkipExtraFilesOnServer>
    <MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
    <EnableMSDeployBackup>True</EnableMSDeployBackup>
    <UserName>mydomain\myusername</UserName>
    <_SavePWD>False</_SavePWD>
    <UseMSDeployServiceURLAsIs>True</UseMSDeployServiceURLAsIs>
  </PropertyGroup>
</Project>
Isaiah answered 12/1, 2017 at 23:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.