I am trying to connect to create connection in using ArcObjects using the code below.

IPropertySet propertySet = new PropertySet();
IWorkspaceFactory sdeWsFactory = new SdeWorkspaceFactory();

propertySet.SetProperty("SERVER", server);
propertySet.SetProperty("INSTANCE", instance);
propertySet.SetProperty("DATABASE", database);
propertySet.SetProperty("USER", user);
propertySet.SetProperty("PASSWORD", password);
propertySet.SetProperty("VERSION", version);

IWorkspace WS = sdeWsFactory.Open(propertySet, 0);
IFeatureWorkspace fws = WS as IFeatureWorkspace;

When it tries to execute the Open, I get the error message: The Product License has not been initialized. How do I tell which "product" it is talking about?

We are runnuing ArcSDE 9.3.1 SP2.

  • Are you running this in Desktop or Engine? Sep 21, 2010 at 18:24
  • 1
    Are you initializing a license using AoInitializeClass? Sep 21, 2010 at 18:27
  • 3
    You can read up in initialization here: resources.esri.com/help/9.3/ArcGISDesktop/dotnet/… Sep 21, 2010 at 18:33
  • I'm not really sure the answers to your questions. We are using AGS but we thought it might be more efficient to connect directly to SDE in some cases. Does that help?
    – mfowler
    Sep 21, 2010 at 19:15
  • 2
    When using ArcObjects in a standalone app you need to check out the license as has been said. If this code runs on a web app (i.e. on the web server), you will need to create all ArcObjects in the server context using IServerContext.CreateObject.
    – Petr Krebs
    Sep 23, 2010 at 8:34

1 Answer 1


I think Jay is correct. Try some code like the following:

        AoInitialize init = new AoInitialize();
        // initialize an ArcGIS Server license if the license is available
        if (init.IsProductCodeAvailable(esriLicenseProductCode.esriLicenseProductCodeArcServer) == esriLicenseStatus.esriLicenseAvailable)
        // throw an exception if the license is not available
            throw new Exception("ESRI ArcGIS Server License is unavailable or has failed");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.