【问题标题】:How to provide password for Web Deploy on Visual Studio (Mac)如何在 Visual Studio (Mac) 上为 Web 部署提供密码
【发布时间】:2020-11-08 02:29:15
【问题描述】:

环境

MacOS 10.14.6 Mojave, Visual Studio For Mac v8.7.9
API service built on .NET Core framework

问题:我有一个 .NET Core 项目,它有一个 Web 部署发布配置文件,用于将更新部署到在 EC2 (IIS) 上运行的 Windows 服务器。 当我在 Windows 上工作时,我可以通过 Visual Studio 中的 Web 部署 UI 轻松部署它,但是在我迁移到 macOS 后,在 Visual Studio 中找不到这样的选项。我可以单击现有的网络部署发布选项,但它总是失败,因为我需要在某处提供密码。我尝试在pubxml 文件下添加<Password>,但它读作无效标签。

现有的发布配置文件

错误

/usr/local/share/dotnet/sdk/3.1.403/Sdks/Microsoft.NET.Sdk.Publish/targets/PublishTargets/Microsoft.NET.Sdk.Publish.MSDeploy.targets(140,5): error : Web deployment task failed. (Connected to the remote computer 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.)
    /usr/local/share/dotnet/sdk/3.1.403/Sdks/Microsoft.NET.Sdk.Publish/targets/PublishTargets/Microsoft.NET.Sdk.Publish.MSDeploy.targets(140,5): error : Make sure the site name, user name, and password are correct. If the issue is not resolved, please contact your local or server administrator.
    /usr/local/share/dotnet/sdk/3.1.403/Sdks/Microsoft.NET.Sdk.Publish/targets/PublishTargets/Microsoft.NET.Sdk.Publish.MSDeploy.targets(140,5): error : Error details:
    /usr/local/share/dotnet/sdk/3.1.403/Sdks/Microsoft.NET.Sdk.Publish/targets/PublishTargets/Microsoft.NET.Sdk.Publish.MSDeploy.targets(140,5): error : Connected to the remote computer ("ec2-3-92-105-216.compute-1.amazonaws.com") 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.
    /usr/local/share/dotnet/sdk/3.1.403/Sdks/Microsoft.NET.Sdk.Publish/targets/PublishTargets/Microsoft.NET.Sdk.Publish.MSDeploy.targets(140,5): error : The remote server returned an error: (401) Unauthorized.
    Publish failed to deploy.

【问题讨论】:

  • 你找到关于那个话题的答案了吗?..
  • @Fellow7000 不幸的是没有......
  • 有一种方法可以在 dotnet 的命令行中提供密码,但在 Mac 上并没有真正的帮助,因为 dotnet 尝试调用另一个“.exe”文件:-/ dotnet publish projectName.csproj /p:PublishProfile=*profileName* /p:Password=*yourPsw*
  • 我明白了,谢谢你的帮助。我切换回 Windows:/
  • 看来我也必须这样做。可能有一种方法可以发布到文件夹中,然后手动进行 webdeploy v. FTP 例如...但是,是的,Visual Studio for Mac 远远落后于 Win...可惜。

标签: macos visual-studio asp.net-core webdeploy


【解决方案1】:

目前我还没有找到答案,但我找到了一种解决方法。

我将项目发布到一个文件夹(注意 dotnet 参数),然后手动将 "bin/Release/netcoreapp3.1/publish" v. ftp 中的文件复制到我的服务器。

为了节省大量时间,只复制较新/不同大小的文件是有意义的。

一点也不优雅,但这就是我现在的工作方式。

很高兴听到,有人找到了如何在 MacOS 上存储 webdeploy 密码的解决方案

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-10-01
    • 2015-06-24
    • 1970-01-01
    • 2014-10-25
    • 2023-03-30
    • 1970-01-01
    • 1970-01-01
    • 2011-05-07
    相关资源
    最近更新 更多