I have been having trouble making a request to my 64-bit ASP.NET Core API running on an Azure App Service. The error I get back is:
Unhandled Exception: System.BadImageFormatException: Could not load file or assembly '***.dll'. An attempt was made to load a program with an incorrect format.
I understand that this means there is a mismatch between the platform of the app (64-bit) and that of the environment it runs on. I just can't figure out how to change the App Service so it runs using 64-bit.
In the Application Settings in the Azure portal I have set Platform to 64-bit:
However when I check in Kudu, the runtime environment indicates that it's operating under win8-x86:
project.json
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true,
"platform": "x64"
},
"runtimes": {
"win10-x64": {}
}
Some questions
- How do I change the App Service to ensure it's running on a 64-bit platform?
- Does it matter that the RID is
win8...
when my runtimes configuration inproject.json
specifieswin10...
. Presumably x86 vs x64 matters, but does it need to be the same version of windows too ie. win8 vs win10.