Closed pavlose closed 7 years ago
I moved recently and do not have my windows machine set up yet. A few ideas in the interim:
/
instead of \
Take a look at GribEnvironment.cs and GribEnvLoadHelper.cs to get an idea of what's going on.
I'll try to get my machine setup soon so I can give you move concrete help.
Hi Eric, Still not able to make it work. Meanwhile, I tried it in a non-ASP.NET app and it worked perfectly. I will let you know if I have any progress. In any case, many thanks for your help.
K, will try to get to it soon. I know I made it work at some point.
@pavlose Sorry for the delay. This works for me:
Environment.SetEnvironmentVariable("GRIB_API_DIR_ROOT", AppDomain.CurrentDomain.RelativeSearchPath);
I'll fix this in the upcoming release so that you don't have to set this manually.
Note, n my ASP.NET project, the Grib.Net reference, "Copy Local" is set to true.
Please let me know if that works.
I hope to have the fix available via nuget in the next 48 hours.
0.7.1 is available on nuget.
Sorry for taking so long to get back to you. I got the newer version 0.7.1. Unfortunately it does not resolve my issue. I tried setting "Copy local" to true, but there is no such option for Grib.api in the reference's properties. I am not sure why this is so... Meanwhile, I have set up a (non-ASP.net) project and started working with Grib.Api. There, "Copy local" is actually set to true, and Grib.api works like a charm (many thanks!!)
Try this: https://github.com/0x1mason/GribApiAspNet
You'll need to restore all the packages via the VS Nuget UI or via the Pkg Manager Console:
PM> nuget restore
The actual code is in Default.aspx.cs
.
GribApiAspNet worked. I also created a new Project->ASP.NET Web Application and it worked. It didn't work in my previous tests, because I had created (and was testing it via) a Website->ASP.NET Empty Website. This is also why I saw no "References" in the solution explorer. Probably because of the differences between asp.net web applications and websites in the solution structure and the way they handle references and dlls.
Glad you got it working. Let me know if you need any further assistance.
Hi Eric, I have an ASP.NET website (working with Visual Studio 2013) and I am trying to use GribApi.NET. I am trying to create a new GribFile, i.e.,
using(GribFile file = new GribFile(weatherpath)) { }
but I keep getting a GribApiException:
GribEnvironment::DefinitionsPath must be a valid path. If you're using ASP.NET or NUnit, this exception is usually caused by shadow copying. Please see GribApi.NET's documentation for help. Path:...
I used your suggestion for shadow copying, i.e., setting
Environment.SetEnvironmentVariable("GRIB_API_DIR_ROOT", "C:\Some\Path", EnvironmentVariableTarget.Process);
but it did not work. I tried to set GribEnvironment.DefinitionsPath myself but it did not work (same error message). Moreover, while debugging, I noticed that GribEnvironment.GribApiVersion has the indication:
"The type initializer for 'Grib.Api.Interop.SWIG.GribApiProxy' threw an exception."
Do you have any suggestions?