I have .Net Core console app that connects to Azure SQL database using entity framework. Every think works fine locally but when I created publish package using this command line
dotnet publish -c Release -r win-x64 --self-contained false
Zipped it and upload it and used it in Azure webjob I get this exception in the job output:
An error occurred using the connection to database 'myDB' on server 'tcp:myServer.database.windows.net,1433'.
[03/13/2019 19:10:11 > 62ab86: INFO] System.TypeInitializationException: The type initializer for 'System.Data.SqlClient.TdsParser' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Data.SqlClient.SNILoadHandle' threw an exception. ---> System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
I added this section to the .json file but it didn't help
"runtimes": {
"win7-x64": {},
"win10-x64": {}
}