extension .nc not registered in the factory (Web Service)

Mar 21, 2011 at 8:30 PM

Hello -

SDS is installed on my development machine, current as of about 10 days ago.

I am trying to make available a web service that uses the SDS to access some NetCDF data.  I wrote a class to handle everything I want to do, and can successfully use that class in a console application.  When I try to access the same data with the same class but from a web service, I get the dreaded "extension .nc not registered in the factory" error when I try to open the netCDF file.

I have tried several ways to use the DataSetFactory static class to register the .NC extension (despite the fact that I should not have to, right?).  The curious thing is that I cannot find the netcdf4.dll anywhere on the machine.  If it is required, but is missing, then I would expect this behavior, but how do you explain the fact that the console application works!?!?!

 

Any help appreciated.

Thanks!

-Malcolm Ross

Mar 23, 2011 at 5:32 AM

All-

 

So I am working hard to try to resolve this by myself, but so far, no luck.  I found the netCDF4.DLL in the source code repository (but not in the runtime installer - why?), but don't know what to do with it to make it work within the web service.  I think it has something to do with changes that need to be made to the web.config file associated with the service, but I can't figure out what those changes are.

Please help!

Thanks

-Malcolm

Mar 23, 2011 at 10:27 AM

Hi Malcolm,

This the bug that Web Service does not automatically registers providers and it will be fixed. But in the current version it is still possible to register the provider manually. For this, you should add following lines into your code before first use of SDS:

DataSetFactory.RegisterAssembly(
    Assembly.Load("Microsoft.Research.Science.Data.NetCDF4, Version=1.2.6754.0, Culture=neutral, PublicKeyToken=e550de0161496f12"));

You also need usings:

using Microsoft.Research.Science.Data.Factory;
using System.Reflection;

The code above loads the provider assembly from GAC and registers it in the DataSet factory.

 

An answer to your question about where NetCDF4.dll is located: it is in GAC (c:\windows\assembly), though Windows Explorer does not show it. To see and, probably, copy it you may use another explorer application, for example, Total Commander, which shows the assembly folder as any other.

Regards,

Dmitry.

Mar 23, 2011 at 6:56 PM

Thanks, Ditmitry

 

That did the trick, except I had to use a different PublicKeyToken.

 

-Malcolm