Error loading hostpolicy.dll while deploying .NET Core console app to Azure WebJobs

后端 未结 3 1746
春和景丽
春和景丽 2021-01-01 23:49

I have followed this tutorial to deploy a .NET Core console application to an Azure Web Service WebJob.

My app is running locally without any issue (with dotnet

相关标签:
3条回答
  • 2021-01-02 00:40

    This error could happen if the bitness of your application doesn't match the bitness of your App Service (e.g. publishing a 64-bit deployment to an App Service running in 32-bit mode).

    To solve this I had to change the bitness to the correct setting in Azure:

    To match the bitness of my publish profile in VS:

    0 讨论(0)
  • 2021-01-02 00:41

    Alright, I've figured it out.

    If you want to deploy a dotnet core app to Azure Web Service, include the runtime "win7-x86" if you are running your app in 32-Bit platform mode.

    For a Visual Studio 2015 solution, your project.json should include :

      "runtimes": {
        "win10-x64": {},
        "win7-x86": {} //IMPORTANT FOR AZURE DEPLOY
      },
    

    Or if you have already migrated to Visual Studio 2017, your .csproj should include this in PropertyGroup:

    <RuntimeIdentifiers>win10-x64;win7-x86</RuntimeIdentifiers>
    

    Also, your publish profile should include the same thing:

    <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup>
        <PublishProtocol>FileSystem</PublishProtocol>
        <Configuration>Release</Configuration>
        <TargetFramework>netcoreapp1.1</TargetFramework>
        <PublishDir>bin\Release\PublishOutput</PublishDir>
        <RuntimeIdentifier>win7-x86</RuntimeIdentifier> // IMPORTANT
      </PropertyGroup>
    </Project>
    
    0 讨论(0)
  • 2021-01-02 00:53

    I stopped seeing this error when I changed the contents of run.cmd from

    dotnet MyWorker.dll

    to

    MyWorker.exe

    0 讨论(0)
提交回复
热议问题