Select to view content in your preferred language

WCF Service with arcobjects not working after publishing

1953
12
08-24-2011 06:48 AM
BernardNtiamoah
Deactivated User
Hi guys,
Here is my problem: I have a very basic wcf service that returns information about a feature class in my silverlight application. Everything works great in the localhost but doesn't work after publishing the application to my server. It just keeps running without throwing any error or timing out. The funny thing is that if i remove all arcobject stuff from the service code, then it works fine. Am I missing something? here is my code.

                ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Server);

                //Initialize ESRI license
                ESRI.ArcGIS.esriSystem.IAoInitialize aoIinitialize = new ESRI.ArcGIS.esriSystem.AoInitialize();
                if (aoIinitialize.Initialize(esriLicenseProductCode.esriLicenseProductCodeArcServer) == esriLicenseStatus.esriLicenseAvailable)
                {
                    aoIinitialize.Initialize(esriLicenseProductCode.esriLicenseProductCodeArcServer);
                }

                IPropertySet propertySet = new PropertySet();

                propertySet.SetProperty("SERVER", "**");
                propertySet.SetProperty("INSTANCE", "***");
                propertySet.SetProperty("DATABASE", "***");
                propertySet.SetProperty("USER", "***");
                propertySet.SetProperty("PASSWORD", "****");
                propertySet.SetProperty("VERSION", "***");

                Type factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.SdeWorkspaceFactory");
                IWorkspaceFactory workspaceFactory = (IWorkspaceFactory)Activator.CreateInstance(factoryType);

                //Establish the connection with the database server
                IWorkspace workspace = workspaceFactory.Open(propertySet, 0);

                //Convert the workspace to feature workspace
                IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)workspace;

                //Open feature class in the database
                featureClass = featureWorkspace.OpenFeatureClass(FCName);
0 Kudos
12 Replies
kaustavroy
Deactivated User
Friends

I am getting  following Error when i am calling wcf method from the Silverlight application

---------------------------

---------------------------
Retrieving the COM class factory for component with CLSID {30707210-52D5-11D0-A8F2-00608C85EDE5} failed due to the following error:
80040111 ClassFactory cannot supply requested class (Exception from HRESULT: 0x80040111 (CLASS_E_CLASSNOTAVAILABLE)).
---------------------------

---------------------------

Please help for me this issue..thanks in advance

Kroy
0 Kudos
kaustavroy
Deactivated User
Sorry it was a mistake i had skipped  IAoInitialize.Its working now
0 Kudos
BernardNtiamoah
Deactivated User
hi Roy,
Add this in the beginning of your code

ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Server);

if the problem persists, right click on the your project =>properties =>Build tab =>change platform target to x86 instead of Any CPU.
0 Kudos