提问人:Chris Barr 提问时间:7/17/2023 更新时间:7/18/2023 访问量:154
如何将 WebPublish 与 Github 操作配合使用 .NET Core 应用程序的 IIS 服务器?
How can I use WebPublish with Github actions to an IIS server for a .NET Core application?
问:
我有一个 .NET Core 6.0 网络应用程序,我正在使用 GoDaddy 的 Windows 豪华托管,它使我能够使用 Plesk 来管理我的网站。我可以为我拥有的每个站点下载一个文件,如下所示*.publishsettings
<?xml version="1.0"?>
<publishData>
<publishProfile profileName="example.com - Web Deploy"
publishMethod="MSDeploy"
publishUrl="https://example.com:8172/msdeploy.axd?site=example.com"
msdeploySite="example.com"
userName="<redacted>"
destinationAppUrl="http://example.com"
controlPanelLink="https://example.shr.prod.phx3.secureserver.net:8443"
/>
</publishData>
当我将其导入 Visual Studio 时,它会生成此文件,并在其中添加了节点。*.pubxml
<UserPWD>
<Project>
<PropertyGroup>
<WebPublishMethod>MSDeploy</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish>http://example.com</SiteUrlToLaunchAfterPublish>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<ExcludeApp_Data>false</ExcludeApp_Data>
<ProjectGuid>c16666a7-f6aa-406d-af77-effb1be3f08f</ProjectGuid>
<MSDeployServiceURL>https://example.com:8172/msdeploy.axd?site=example.com</MSDeployServiceURL>
<DeployIisAppPath>example.com</DeployIisAppPath>
<RemoteSitePhysicalPath />
<SkipExtraFilesOnServer>true</SkipExtraFilesOnServer>
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
<EnableMSDeployBackup>true</EnableMSDeployBackup>
<EnableMsDeployAppOffline>true</EnableMsDeployAppOffline>
<UserName>REDACTED</UserName>
<UserPWD>REDACTED</UserPWD>
<_SavePWD>true</_SavePWD>
<TargetFramework>net6.0</TargetFramework>
<SelfContained>false</SelfContained>
</PropertyGroup>
</Project>
我已将该文件保存为名为 的 github 机密,然后我利用 Azure webapps-deploy 操作进行部署*.pubxml
PUBLISH_PROFILE_PROD
name: 🚀 Deploy website to PROD
on:
workflow_dispatch:
push:
branches: [main]
paths-ignore: [".vscode/**", "README.md", ".*"]
permissions:
contents: write
jobs:
web-deploy:
name: 🎉 Deploy Prod
runs-on: ubuntu-latest
steps:
- name: 🚚 Get latest code
uses: actions/checkout@v3
- name: Setup .NET Core SDK ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet publish --configuration Release --no-restore
- name: Deploy
uses: azure/webapps-deplo[email protected]
with:
app-name: example.com
publish-profile: ${{ secrets.PUBLISH_PROFILE_PROD }}
package: ./bin/Release/net6.0/publish
此操作运行时,它将失败,并显示以下错误:
Error: Failed to fetch credentials from Publish Profile. For more details on how to set publish profile credentials refer https://aka.ms/create-secrets-for-GitHub-workflows
Error: Deployment Failed, Error: Publish profile does not contain kudu URL
是我做错了什么,是我的服务器不接受这个,还是有其他问题?
(我也在 github 操作页面上对此进行了讨论)
答:
0赞
Douglas Thomas
7/18/2023
#1
那么,您使用 Godaddy 设置并将其发布到 Azure 上?是吗?我相信它不起作用,因为 webdeploy 设置仅适用于您现在使用的托管服务提供商。
评论
1赞
Chris Barr
7/18/2023
不,我不会在 Azure 上发布它。我想在我的 GoDaddy 主机上发布它。我正在使用 Azure github 操作,因为它可以处理 WebDeploy
评论