ASP.NET Core RC2部署到Azure问题 - Visual Studio Team Services

时间:2016-06-23 06:53:22

标签: azure azure-devops

我们在Azure上有一个ASP.NET Core RC2网站,我们希望能够从Visual Studio Team Services(以前的Visual Studio Online)部署它,但似乎存在一个特殊问题。

首先,我应该说可以从Visual Studio手动部署网站,这非常正常。

在发现RC1脚本不起作用的困难之后,我切换到RC2脚本(由Visual Studio生成)并尝试但是我收到此错误:

  

错误代码:ERROR_DESTINATION_NOT_REACHABLEMore信息:不能   连接到远程计算机(“redacted.scm.azurewebsites.net”)。上   远程计算机,确保已安装Web Deploy   启动所需的过程(“Web管理服务”)。学习   更多:   http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_DESTINATION_NOT_REACHABLE.Error:   无法连接到远程服务器错误:连接尝试   失败,因为关联方在a之后没有正确回应   一段时间,或建立的连接失败,因为连接   主机未能响应编辑:8172错误计数:1。

我应该看到端口号,但我没有这样,我修改了脚本以转储publishProperties

call Publish-AspNet to perform the publish operation with publishProperties
WebPublishMethod:MSDeploy
Username:$AssessAuth
DeployIisAppPath:AssessAuth
Password:
MSDeployServiceUrl:redacted.scm.azurewebsites.net
Publishing with publish method [MSDeploy]
Executing command ["C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -source:manifest='C:\a\13c087afa\BuildAuthServer\pac\AuthServer\src\AuthServer\bin\release\netcoreapp1.0\obj\SourceManifest.xml' -dest:manifest='C:\a\13c087afa\BuildAuthServer\pac\AuthServer\src\AuthServer\bin\release\netcoreapp1.0\obj\DestManifest.xml',ComputerName='https://redacted.scm.azurewebsites.net:8172/msdeploy.axd',UserName='$AssessAuth',Password='{PASSWORD-REMOVED-FROM-LOG}',IncludeAcls='False',AuthType='Basic' -verb:sync  -enableRule:DoNotDeleteRule -retryAttempts:20 -disablerule:BackupRule]

不用说,没有任何东西可以监听端口8172,至少不是我的实例。

有人知道端口8172来自哪里吗?

在azure应用程序上有什么我需要改变的吗?

对我来说,Publish-AspNet似乎是个bug但是......

我用作参考的脚本:

# Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
# Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

[cmdletbinding(SupportsShouldProcess=$true)]
param($publishProperties=@{}, $packOutput, $pubProfilePath, $nugetUrl)

# to learn more about this file visit https://go.microsoft.com/fwlink/?LinkId=524327
$publishModuleVersion = '1.1.0'

function Get-PublishModulePath{
    [cmdletbinding()]
    param()
    process{
        $keysToCheck = @('hklm:\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\{0}',
                         'hklm:\SOFTWARE\Microsoft\VisualStudio\{0}',
                         'hklm:\SOFTWARE\Wow6432Node\Microsoft\VWDExpress\{0}',
                         'hklm:\SOFTWARE\Microsoft\VWDExpress\{0}'
                         )
        $versions = @('14.0', '15.0')

        [string]$publishModulePath=$null
        :outer foreach($keyToCheck in $keysToCheck){
            foreach($version in $versions){
                if(Test-Path ($keyToCheck -f $version) ){
                    $vsInstallPath = (Get-itemproperty ($keyToCheck -f $version) -Name InstallDir -ErrorAction SilentlyContinue | select -ExpandProperty InstallDir -ErrorAction SilentlyContinue)

                    if($vsInstallPath){
                        $installedPublishModulePath = "{0}Extensions\Microsoft\Web Tools\Publish\Scripts\{1}\" -f $vsInstallPath, $publishModuleVersion
                        if(!(Test-Path $installedPublishModulePath)){
                            $vsInstallPath = $vsInstallPath + 'VWDExpress'
                            $installedPublishModulePath = "{0}Extensions\Microsoft\Web Tools\Publish\Scripts\{1}\" -f  $vsInstallPath, $publishModuleVersion
                        }
                        if(Test-Path $installedPublishModulePath){
                            $publishModulePath = $installedPublishModulePath
                            break outer;
                        }
                    }
                }
            }
        }

        $publishModulePath
    }
}

$publishModulePath = Get-PublishModulePath

Write-Host "PublishModulePath: "  $pubProfilePath

$defaultPublishSettings = New-Object psobject -Property @{
    LocalInstallDir = $publishModulePath
}

function Enable-PackageDownloader{
    [cmdletbinding()]
    param(
        $toolsDir = "$env:LOCALAPPDATA\Microsoft\Web Tools\Publish\package-downloader-$publishModuleVersion\",
        $pkgDownloaderDownloadUrl = 'https://go.microsoft.com/fwlink/?LinkId=524325') # package-downloader.psm1
    process{
        if(get-module package-downloader){
            remove-module package-downloader | Out-Null
        }

        if(!(get-module package-downloader)){
            if(!(Test-Path $toolsDir)){ New-Item -Path $toolsDir -ItemType Directory -WhatIf:$false }

            $expectedPath = (Join-Path ($toolsDir) 'package-downloader.psm1')
            if(!(Test-Path $expectedPath)){
                'Downloading [{0}] to [{1}]' -f $pkgDownloaderDownloadUrl,$expectedPath | Write-Verbose
                (New-Object System.Net.WebClient).DownloadFile($pkgDownloaderDownloadUrl, $expectedPath)
            }

            if(!$expectedPath){throw ('Unable to download package-downloader.psm1')}

            'importing module [{0}]' -f $expectedPath | Write-Output
            Import-Module $expectedPath -DisableNameChecking -Force
        }
    }
}

function Enable-PublishModule{
    [cmdletbinding()]
    param()
    process{
        if(get-module publish-module){
            remove-module publish-module | Out-Null
        }

        if(!(get-module publish-module)){
            $localpublishmodulepath = Join-Path $defaultPublishSettings.LocalInstallDir 'publish-module.psm1'
            if(Test-Path $localpublishmodulepath){
                'importing module [publish-module="{0}"] from local install dir' -f $localpublishmodulepath | Write-Verbose
                Import-Module $localpublishmodulepath -DisableNameChecking -Force
                $true
            }
        }
    }
}

try{

Write-Host "Start Deployment for real."

    if (!(Enable-PublishModule)){
        Write-Host 'Get Publish module from nuget. NugetUrl ' + $nugetUrl 
        Enable-PackageDownloader
        Enable-NuGetModule -name 'publish-module' -version $publishModuleVersion -nugetUrl $nugetUrl
    }

    'Calling Publish-AspNet' | Write-Verbose
    Write-Host 'call Publish-AspNet to perform the publish operation with publishProperties'
    $publishProperties.GetEnumerator() | %{"{0}:{1}" -f $_.Name,$_.Value}
    Publish-AspNet -publishProperties $publishProperties -packOutput $packOutput -pubProfilePath $pubProfilePath
}
catch{
    "An error occurred during publish.`n{0}" -f $_.Exception.Message | Write-Error
    exit 1
}

0 个答案:

没有答案