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
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:
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>
I stopped seeing this error when I changed the contents of run.cmd from
dotnet MyWorker.dll
to
MyWorker.exe