Select to view content in your preferred language

WCF Service with arcobjects not working after publishing

1951
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
weiliang
Deactivated User
Hi, Bernard. Have you installed the ArcObjects development kit on your server? It seems that you lost all the dll on the web server.

Cheers,

Wei
0 Kudos
BernardNtiamoah
Deactivated User
Hi wei, thanks for the reply.
Yes, I have installed Arcobject SDK on the server.
0 Kudos
weiliang
Deactivated User
Have you checked the windows log file to see if there is anything helpful?

Wei
0 Kudos
BernardNtiamoah
Deactivated User
Yes I did but there was nothing there. I even used fiddler but all the i got was "server error with error code of 500"
0 Kudos
weiliang
Deactivated User
Does your website has any security setting there?

Also, we didn't check the AO license in the code, so may comment out that part of code and give it a try.

Wei
0 Kudos
BernardNtiamoah
Deactivated User
This is the error message fiddler reported
" Could not load file or assembly 'ESRI.ArcGIS.Version. 10.0.0.0 Culture=netural, PublicKeyToken = ..... or its dependencies. The system cannot find the file specified."
0 Kudos
BrianGustafson
Occasional Contributor
What Type of server is it running on?  I was getting that error a while back and I needed to setup my 64 bit server to run 32 bit applications to load the 32 bit esri dlls.
0 Kudos
BernardNtiamoah
Deactivated User
Hi guys,
I solved the problem. Thank you all for helping. This problem was that the "Enable 32-Bit Applications" in the application pool settings was false. After changing that to true, everything is working fine.
0 Kudos
weiliang
Deactivated User
Good to know.

Wei
0 Kudos