English 中文(简体)
How can I use WebPublish with Github actions to an IIS server for a .NET Core application?
原标题:

I have a .NET Core 6.0 webapp and I am using GoDaddy s windows deluxe hosting which gives me Plesk to administer my sites. I can download a *.publishsettings file for each site I have, which looks like this

<?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>

When I import that into Visual Studio it generates this *.pubxml file, to which I added the <UserPWD> node.

<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>

I ve saved that *.pubxml file as a github secret called PUBLISH_PROFILE_PROD, and then I have this github action for deployment making use of the Azure webapps-deploy action

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-deploy@v2.2.10
        with:
          app-name: example.com
          publish-profile: ${{ secrets.PUBLISH_PROFILE_PROD }}
          package: ./bin/Release/net6.0/publish

When this action runs, it fails with this error:

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

Am I doing something wrong, is my server not accepting this, or is there some other problem?

(I have opened a discussion about this on the github action page as well)

问题回答

So, you use the Godaddy settings and publish it on Azure? Is that right? I believe that it can t work since webdeploy settings only applicable on hosting provider that you use now.





相关问题
VS 2008 : How to publish with out DLLs?

I have developed a web application in Visual Studio 2008 and want to publish it in to the production server. I see a publish option there.But its producing files with DLL. I dont want to publish only ...

Apache: Deploying a new site to the server

I have a site currently live on a domain. I would like to switch it to a new site, that is currently in a password protected sub directory on this server. I have a "Site Maintenance in Progress" page....

Appropriate strategy for tagging and hotfixing with git

I was wondering if the strategy I m using for tagging and hotfixing tags (which then I use for deploying rails applications) with git is appropriate. For tagging I just tag a commit of the master ...

Pylons deployment questions

I m a beginner with Pylons and I ve mostly developed on my localhost using the built-in web server. I think it s time to start deployment for my personal blog, I have a Debian Lenny server with ...

Do I want Publish or Release Build in VB.net?

I wrote a little (like 40 lines little) Winforms application with VB.net in Visual Studio 2010. Now I ve released the code as a Google Code project. It s easy for a developer to get the source but I d ...

Need advice on my PHP development solution

Here is how our current php development solution is set up: Each developer work on their local machine. Each developer commit their change to a common SVN server (intranet). A commit hook upload the ...

loading from JAR files during deployment vs development

when i am loading some data into my java program, i usually use FileInputStream. however i deploy the program as a jar file and webstart, so i have to use getRessource() or getRessourceAsStream() to ...

热门标签