Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从tfs将Web部署到IIS到站点应用程序_Iis_Asp.net Core_Tfsbuild_Webdeploy_Webdeploy 3.6 - Fatal编程技术网

从tfs将Web部署到IIS到站点应用程序

从tfs将Web部署到IIS到站点应用程序,iis,asp.net-core,tfsbuild,webdeploy,webdeploy-3.6,Iis,Asp.net Core,Tfsbuild,Webdeploy,Webdeploy 3.6,我正在尝试让tfs build server将asp.net核心站点部署到运行iis的.net framework asp.net web api站点的应用程序中 如果我将asp.net核心应用程序创建为自己的网站,共享同一个应用程序文件夹,我就可以让它工作 我正在调用VisualStudio在使用web deploy时生成的powershell脚本 它生成的调用是 > "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe"

我正在尝试让tfs build server将asp.net核心站点部署到运行iis的.net framework asp.net web api站点的应用程序中

如果我将asp.net核心应用程序创建为自己的网站,共享同一个应用程序文件夹,我就可以让它工作

我正在调用VisualStudio在使用web deploy时生成的powershell脚本

它生成的调用是

> "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe"
> -source:manifest='C:\Users\BuildService\AppData\Local\Temp\PublishTemp\obj\a\SourceManifest.xml'
> -dest:manifest='C:\Users\BuildService\AppData\Local\Temp\PublishTemp\obj\a\DestinationManifest.xml',ComputerName='https://server:8172/msdeploy.axd?site=Demo%20mainSite/dotnetCoreApp',UserName='username',Password='{{PASSWORD-REMOVED-FROM-LOG}}',IncludeAcls='False',AuthType='Basic'
> -verb:sync -enableRule:DoNotDeleteRule -retryAttempts:20 -disablerule:BackupRule -allowUntrusted
收到的错误是

错误代码:错误\用户\未经授权详细信息:连接到 使用Web管理服务的远程计算机服务器,但可能 不授权。确保您使用的用户名和密码正确 密码,您连接的站点存在,并且 凭据表示具有访问站点权限的用户。 了解更多信息,请访问: : 远程服务器返回错误:401未经授权。错误计数: 一,

这可能是找不到站点或用户名/密码错误。正如我在将其更改为站点时提到的脚本,除非我缺少站点应用程序所需的特殊权限,否则它不应该是站点所不需要的

构建定义

参数字符串

-packOutput "$(build.artifactstagingdirectory)" -publishProperties @{'WebPublishMethod'='MSDeploy';      'MSDeployServiceURL'='$(remoteUrl)'; 'DeployIisAppPath'='$(appName)';'UserName'='$(ausername)';'Password'="$(password)"; 'EnvironmentName'='$(environment)'; 'EnableMSDeployBackup'='$(backup)';'AllowUntrustedCertificate'='true'} -Verbose
变数

完整日志

2017-02-02T15:06:25.0517357Z . 'B:\_work\108\a\server-publish.ps1' -packOutput "B:\_work\108\a" -publishProperties @{'WebPublishMethod'='MSDeploy';      'MSDeployServiceURL'='https://server'; 'DeployIisAppPath'='Demo mainSite/dotnetCoreApp';'UserName'='username';'Password'="********"; 'EnvironmentName'='staging'; 'EnableMSDeployBackup'='false';'AllowUntrustedCertificate'='true'} -Verbose

2017-02-02T15:06:25.0547361Z Executing the following powershell script. (workingFolder = B:\_work\108\s)

2017-02-02T15:06:25.0547361Z B:\_work\108\a\server-publish.ps1 -packOutput "B:\_work\108\a" -publishProperties @{'WebPublishMethod'='MSDeploy';      'MSDeployServiceURL'='https://server'; 'DeployIisAppPath'='Demo mainSite/dotnetCoreApp';'UserName'='username';'Password'="********"; 'EnvironmentName'='staging'; 'EnableMSDeployBackup'='false';'AllowUntrustedCertificate'='true'} -Verbose

2017-02-02T15:06:25.6777700Z VERBOSE: Loading module from path 'B:\_work\108\a\publish-module.psm1'.

2017-02-02T15:06:25.7307946Z VERBOSE: Exporting function 'Register-AspnetPublishHandler'.

2017-02-02T15:06:25.7307946Z VERBOSE: Exporting function 'Get-AspnetPublishHandler'.

2017-02-02T15:06:25.7317771Z VERBOSE: Exporting function 'Publish-AspNet'.

2017-02-02T15:06:25.7327889Z VERBOSE: Exporting function 'Publish-AspNetMSDeploy'.

2017-02-02T15:06:25.7327889Z VERBOSE: Exporting function 'Publish-AspNetMSDeployPackage'.

2017-02-02T15:06:25.7337689Z VERBOSE: Exporting function 'Publish-AspNetFileSystem'.

2017-02-02T15:06:25.7337689Z VERBOSE: Exporting function 'Get-PropertiesFromPublishProfile'.

2017-02-02T15:06:25.7348209Z VERBOSE: Exporting function 'Get-MSDeploy'.

2017-02-02T15:06:25.7397836Z VERBOSE: Registering MSDeploy handler

2017-02-02T15:06:25.7607760Z VERBOSE: Adding handler for [MSDeploy]

2017-02-02T15:06:25.7637948Z VERBOSE: Registering MSDeploy package handler

2017-02-02T15:06:25.7647892Z VERBOSE: Adding handler for [Package]

2017-02-02T15:06:25.7657950Z VERBOSE: Registering FileSystem handler

2017-02-02T15:06:25.7667860Z VERBOSE: Adding handler for [FileSystem]

2017-02-02T15:06:25.7677977Z VERBOSE: Importing function 'Get-AspnetPublishHandler'.

2017-02-02T15:06:25.7677977Z VERBOSE: Importing function 'Get-MSDeploy'.

2017-02-02T15:06:25.7687917Z VERBOSE: Importing function 'Get-PropertiesFromPublishProfile'.

2017-02-02T15:06:25.7687917Z VERBOSE: Importing function 'Publish-AspNet'.

2017-02-02T15:06:25.7697881Z VERBOSE: Importing function 'Publish-AspNetFileSystem'.

2017-02-02T15:06:25.7707794Z VERBOSE: Importing function 'Publish-AspNetMSDeploy'.

2017-02-02T15:06:25.7707794Z VERBOSE: Importing function 'Publish-AspNetMSDeployPackage'.

2017-02-02T15:06:25.7717769Z VERBOSE: Importing function 'Register-AspnetPublishHandler'.

2017-02-02T15:06:25.8108318Z Publishing with publish method [MSDeploy]

2017-02-02T15:06:25.8558374Z VERBOSE: Adding default property to publishProperties ["SkipExtraFilesOnServer"="True"]

2017-02-02T15:06:25.8587850Z VERBOSE: Adding default property to publishProperties ["retryAttempts"="20"]

2017-02-02T15:06:25.8607935Z VERBOSE: Adding default property to publishProperties ["DeleteExistingFiles"="False"]

2017-02-02T15:06:25.8618096Z VERBOSE: Adding default property to publishProperties ["MSDeployPackageContentFoldername"="website\"]

2017-02-02T15:06:25.8638077Z VERBOSE: Adding default property to publishProperties ["AuthType"="Basic"]

2017-02-02T15:06:25.8647915Z VERBOSE: Adding default property to publishProperties ["MSDeployUseChecksum"="False"]

2017-02-02T15:06:25.8658376Z VERBOSE: Adding default property to publishProperties ["MSDeployPublishMethod"="WMSVC"]

2017-02-02T15:06:26.1098668Z VERBOSE: Found msdeploy.exe at [C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe]

2017-02-02T15:06:26.1168709Z Executing command ["C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -source:manifest='C:\Users\BuildService\AppData\Local\Temp\PublishTemp\obj\a\SourceManifest.xml' -dest:manifest='C:\Users\BuildService\AppData\Local\Temp\PublishTemp\obj\a\DestinationManifest.xml',ComputerName='https://server:8172/msdeploy.axd?site=Demo%20mainSite/dotnetCoreApp',UserName='username',Password='{{PASSWORD-REMOVED-FROM-LOG}}',IncludeAcls='False',AuthType='Basic' -verb:sync -enableRule:DoNotDeleteRule -retryAttempts:20 -disablerule:BackupRule -allowUntrusted]

2017-02-02T15:06:26.1218393Z VERBOSE: Found msdeploy.exe at [C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe]

2017-02-02T15:06:27.2510114Z Info: Using ID '7b0f156a-8f7a-4259-84df-93d9008e6f22' for connections to the remote server.

2017-02-02T15:06:27.2900134Z ##[error]Error Code: ERROR_USER_UNAUTHORIZEDMore Information: Connected to the remote computer ("server") using the Web Management Service, but could not authorize. Make sure that you are using the correct user name and password, that the site you are connecting to exists, and that the credentials represent a user who has permissions to access the site.  Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_USER_UNAUTHORIZED.Error: The remote server returned an error: (401) Unauthorized.Error count: 1.

2017-02-02T15:06:27.2910140Z ##[error]Process completed with exit code 0 and had 1 error(s) written to the error stream.
如上所述,错误\用户\未授权通常表示身份验证或授权问题,并且可能由于以下任何原因而发生:

用户不存在 如果使用Web连接,则用户没有IIS管理器访问站点的权限 管理服务 网站不存在 密码不正确 如果使用Web管理服务进行连接,请确保已检查以下解决方案:

验证用户名和密码是否正确 验证站点是否存在 验证用户是否具有对站点作用域的IIS管理器权限 还可以尝试以下步骤:

在IIS管理器中选择网站 打开IIS管理器权限 验证您部署为的用户是否已添加。如果没有,请单击允许用户并添加它。
你能分享你的构建定义吗?您是如何部署项目的?我添加了图像。有没有一种方法可以显示文本,或者对您来说已经足够了?在脚本中包含用户名和密码而不是参数如何?向脚本中添加用户名和密码无效。如果手动运行该命令,是否可以成功发布输出?