Closed moab360 closed 7 years ago
What I would do is add a ton of logging and look for the file. Does it work without SetEnvVar
? Also, log the bitness to be sure.
Okay, after some debugging I think I found the issue. I'm using 1.0.0-beta, and Grib.Api.Native.dll depends on the following
Besides Kernel32.dll, the others are not available on the server. Sadly I can't add and register dlls either.
I'm noticing that version 0.7.1, Grib.Api.Native.dll relies on
these are available and registered on the server, but I require the 1.0.0-beta to work with the Canadian Meteorological Centeres grib files (blurg). I'm not sure if the dependencies changed or the compile options changed with 1.0.0. Any help would be great!
This is a duplicate of #64. In short the Grib.Api.Native.dll in 1.0.0-beta is build against debug dlls from Microsoft Visual C++ Redistributable 2015.
Yup that's it. Thanks for the pointer
@moab360 were you ever able to get this working in an azure function? I'm using the 1.0.0-beta4 and get
System.DllNotFoundException: 'Unable to load DLL 'Grib.Api.Native.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)'
When attempting to load the native dll.
Its specifically on this line in Grib.Api.Interop.Util.GribApiNative.cs:
[DllImport("Grib.Api.Native.dll")] internal static extern void SetDefaultDefinitionsPath([MarshalAs(UnmanagedType.LPStr)]string path);
Just jumping in to see if I can determine if a dependency is missing or some other config is off. Was there any other special steps you took to get this running in an Azure function? Have you tried the beta4?
Thanks!
Well, turns out copying the Grib.Api.Native.dll to the functions bin folder worked.
I've had a similar experience for a project of this structure: MyConsoleApp --> MyLibrary --> GribApi.Net
The bin folder of MyLibrary contains the Grib.Api dlls. The dependency on MyLibrary does not causes Grib.Api dlls to be copied to the bin folder of MyConsoleApp.
Hi, I managed to use Grib.Api with a WebJobs app (Functions rely on WebJobs behind the scene). In order to do this, you need to copy the full Grib.Api folder to Azure and reference this folder in your code.
Hi there, I'm finally getting around to moving my workflows (currently using wgrib2.exe) over to GribApi. The 1.0 beta is doing a great job chewing through the Canadian Meteorological Center's grib files.
I'm also migrating my workflows into Azure Functions to reduce the load on my server when publishing new forecasts. And that's where I'm running into problems.
I'm setting the Environment variable to point at the GribApi root
Environment.SetEnvironmentVariable("GRIB_API_DIR_ROOT", @"D:\home\data\Functions\packages\nuget\grib.api\1.0.0-beta", EnvironmentVariableTarget.Process);
But the second I call
using (GribFile file = new GribFile(TemporaryGribLocation)){...
I get the following exception. I've checked the location where the dll is being looked for and it is there. One thing that I'm investigating is that I think Azure Functions are on 64bit, so it's strange the x86 dll is being called on...
Any ideas/help would be great
Thanks!