Resource data was not found

Cory Gregor cgregor at barkerlemar.com
Tue Oct 10 16:03:01 EDT 2006


The code is blowing up on this line:  map.Open(ResourceService,
mgResourceID);
The browser is telling me " Resource datawas not found:  RuntimeDataResource
data was not found: ....."

Is the some IIS config problem maybe?  IIS 6 on Win2k3 Server.

Here is the code...

    //String mapDefinition =
"Library://Samples/FredWeber/Maps/Default.MapDefinition";
    //String webLayout = "Library://Samples/FredWeber/FredWeber.WebLayout";
    String sessionId = "";
    String NoLayers = "No Layers Selected";

    try
    {
        MapGuideApi.InitializeSockets();
        InitializeWebTier();

        MgUserInformation userInfo = new MgUserInformation("XXXX","YYYY");
        MgSite site = new MgSite();

        site.Open(userInfo);

        sessionId = site.CreateSession();

        MgSiteConnection siteConnection = new MgSiteConnection();
        siteConnection.Open(userInfo);

        MgResourceService ResourceService =
siteConnection.CreateService(MgServiceType.ResourceService) as
MgResourceService;
        MgFeatureService FeatureService =
siteConnection.CreateService(MgServiceType.FeatureService) as
MgFeatureService;
        MgFeatureQueryOptions QueryOptions = new MgFeatureQueryOptions();

        MgResourceIdentifier mgResourceID = new
MgResourceIdentifier(mapDefinition);
        
        MgMap map = new MgMap();
        
        map.Open(ResourceService, mgResourceID);
        Response.Write("Got here");
        MgSelection selection = new MgSelection(map);

        selection.Open(ResourceService, "map");

        MgReadOnlyLayerCollection Layers = selection.GetLayers();

        if (Layers.GetCount() > 0)
        {
            for (int i = 0; i < Layers.GetCount(); i++)
            {

                //Only check selected features in the Parcels layer.

                MgLayer Layer = Layers.GetItem(i);

                if (Layer != null && Layer.GetLayerDefinition() == new
MgResourceIdentifier("Default_Map Base_727(3)"))
                {
                    //Create a filter containing the IDs of the selected 
                    //features on this layer

                    string LayerClassName = Layer.GetFeatureClassName();
                    string selectionString = selection.GenerateFilter(Layer,
LayerClassName);

                    //Get the feature resource for the selected layer

                    string LayerFeatureId = Layer.GetFeatureSourceId();
                    MgResourceIdentifier LayerFeatureResource = new
MgResourceIdentifier(LayerFeatureId);

                    //Apply the filter to the feature resource for the 
                    // selected layer. This returns


                    //an MgFeatureReader of all the selected features.

                    QueryOptions.SetFilter(selectionString);

                    MgFeatureReader FeatureReader =
FeatureService.SelectFeatures(LayerFeatureResource, LayerClassName,
QueryOptions);

                    //Process each item in the MgFeatureReader, displaying
the 
                    //owner name and address

                    while (FeatureReader.ReadNext())
                    {

                        string val = FeatureReader.GetString("FeatureID");

                        //FeatureReader.GetString("Layer");

                        Response.Write(val);

                    }

                }

            }

        }

        else
        {
            Response.Write(NoLayers);
        }    
       

        MapGuideApi.TerminateSockets();
    }
    catch (MgException mge)
    {
        Response.Write(mge.GetMessage());
        Response.Write(mge.GetDetails());
        MapGuideApi.TerminateSockets();
    }
-- 
View this message in context: http://www.nabble.com/Resource-data-was-not-found-tf2419141.html#a6744260
Sent from the OSGeo MapGuide mailing list archive at Nabble.com.





More information about the Mapguide-users mailing list