FDO in C# ASP.Net Web Application

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

FDO in C# ASP.Net Web Application

Jamo
I've been going round in circles trying to figure this out ....
I've got the following DLLs and providers.xml from the FDO 3.4.1 Windows release in the bin directory of my website .... (untill i can figure out how to put them in a sub dir)

boost_date_time-vc90-mt-1_34_1.dll
boost_thread-vc90-mt-1_34_1.dll
ExpressionEngine.dll
FDO.dll
FDOCommon.dll
FDOGeometry.dll
FDOMessage.dll
FDOSpatial.dll
gdal16.dll
OSGeo.FDO.Common.dll
OSGeo.FDO.dll
OSGeo.FDO.Geometry.dll
OWS.dll
providers.xml
SDFMessage.dll
SDFProvider.dll
Xalan-C_1_7_0.dll
XalanMessages_1_7_0.dll
xerces-c_2_5_0.dll

com\fdo_sys.sql
com\fdo_sys_idx.sql
com\fdosys_sys.sql

--providers xml has been stripped back so it's just sdf provider. while testing.
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<FeatureProviderRegistry>
  <FeatureProvider>
    <Name>OSGeo.SDF.3.4</Name>
    <DisplayName>OSGeo FDO Provider for SDF</DisplayName>
    <Description>Read/write access to Autodesk's spatial database format, a file-based personal geodatabase that supports multiple features/attributes, spatial indexing, and file-locking.</Description>
    <IsManaged>False</IsManaged>
    <Version>3.4.0.0</Version>
    <FeatureDataObjectsVersion>3.4.0.0</FeatureDataObjectsVersion>
    <LibraryPath>.\SDFProvider.dll</LibraryPath>
  </FeatureProvider>
</FeatureProviderRegistry>

--And finally the code that breaks it ...

try
        {
            IProviderRegistry p = FeatureAccessManager.GetProviderRegistry();
            Response.Write(p.GetProviders().Count.ToString());
        }
        catch (System.Runtime.InteropServices.SEHException a)
        {
            Response.Write(a.Message);
        }


I'm sure I've gone over kill on the Dlls but I can't figure out what I'm missing or what this exception is :(
MapGuide Maestro 6.0.0.8587
MapGuide Opensource 3.0.0.8701
Fusion, PHP, Apache
Windows 7 Pro SP1
Reply | Threaded
Open this post in threaded view
|

Re: FDO in C# ASP.Net Web Application

Jackie Ng
IIRC, I think this is because ASP.net shadow copies your web app dlls to some special location for execution, and the FDO dlls aren't being copied along for the ride.

Perhaps, append the FDO path to the PATH environment variable before you use any part of the FDO API (eg. in Application_Start)?

- Jackie
Reply | Threaded
Open this post in threaded view
|

Re: FDO in C# ASP.Net Web Application

Jamo
Jackie is this process as easy as setting this in the Application_Start ?
Environment.SetEnvironmentVariable("FDO", Server.MapPath("Bin"));


Response.Write("Path Mapped to " + Environment.GetEnvironmentVariable("FDO") + "<BR/>");
            IProviderRegistry p = FeatureAccessManager.GetProviderRegistry();

            Response.Write(p.GetProviders().Count.ToString());
//Running this returns.

Path Mapped to D:\mapguide\web\www\portbrisTest\Bin
External component has thrown an exception.

I've done this but there seems to be no change...?
MapGuide Maestro 6.0.0.8587
MapGuide Opensource 3.0.0.8701
Fusion, PHP, Apache
Windows 7 Pro SP1
Reply | Threaded
Open this post in threaded view
|

Re: FDO in C# ASP.Net Web Application

Jackie Ng
Well it should be PATH instead of FDO, and you should append and not set, but that is the idea.

- Jackie
Reply | Threaded
Open this post in threaded view
|

Re: FDO in C# ASP.Net Web Application

pinky_s
Hi every bdy,
had any one succeed to deal with fdo API and establish a connection to a datastore in ASP .NET WebApplication? (VS 2005)
  steps that I followed:
created a a new website
added a folder named BIN to the  website1 folder
i added the folowing dlls:
OSGEO.FDO.dll
OSGEO.FDO.COMMON.dll
OSGEO.FDO.Geometry.dll
OSGEO.FDO.spatial.dll
Xalan-C_1_7_0.dll
XalanMessages_1_7_0.dll
xerces-c_2_5_0.dll

im using FDO 3.4

//---------------my code is----------------------------

 //Firstly, get an instance of the connection manager.
        connManager = FeatureAccessManager.GetConnectionManager();
        //Call the manager’s CreateConnection() method to obtain a connection object.
        conn = connManager.CreateConnection("OSGeo.PostGIS.3.4");
        IConnectionPropertyDictionary connProperties = conn.ConnectionInfo.ConnectionProperties;
        connProperties.SetProperty("Username", "admin");
        connProperties.SetProperty("Password", "admin");
        connProperties.SetProperty("Service", "192.168.10.33:5432");
        //not specifying Datastore as creating a new one

         createDSCmd = conn.CreateCommand(OSGeo.FDO.Commands.CommandType.CommandType_CreateDataStore) as ICreateDataStore;
        createDSCmd.DataStoreProperties.SetProperty("DataStore", "novec");
        createDSCmd.DataStoreProperties.SetProperty("Description", "test");
        createDSCmd.Execute();



I have exception in:

à FdoFeatureAccessManager.GetConnectionManager() à OSGeo.FDO.ClientServices.FeatureAccessManager.GetConnectionManager()

thank you for help!

Reply | Threaded
Open this post in threaded view
|

Re: FDO in C# ASP.Net Web Application

Jackie Ng
From what I can see, you are missing the following files:

 - providers.xml
 - Your PostGIS provider dlls

The exception is because your providers.xml is missing or it couldn't load the PostGIS provider dll specified in providers.xml

- Jackie
Reply | Threaded
Open this post in threaded view
|

Re: FDO in C# ASP.Net Web Application

lifan-tg
This post has NOT been accepted by the mailing list yet.
In reply to this post by Jamo
Hi Jamo,

I got the same problem, have you figured out the problem now?

Thanks,
James