Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
Are you running this in Desktop or Engine? – MathiasWestin Sep 21 '10 at 18:24
Are you initializing a license using AoInitializeClass? – Jay Cummins Sep 21 '10 at 18:27
You can read up in initialization here:… – MathiasWestin Sep 21 '10 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 '10 at 19:15
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 '10 at 8:34

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");
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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