Select to view content in your preferred language

10.1 ArcObject SDK crash on SdeWorkspaceFactory

4545
5
04-05-2013 12:20 PM
ChrisLim
Emerging Contributor
I have very weird crash without any error message on my WCF code on ArcGIS 10.1 SP1. If WCF Service is running as local admin application pool on IIS it works without any problem. As soon as application pool user changes to limited access (IIS_IUSR), beliow line crashes withoug any log or error message. Same code ran fine till ArcGIS 10.0, since it has no logs or any information, it is impossible to workaround. My code is bound with EngineOrServer with proper licensing initialization right before this line of code is being called.


IWorkspaceFactory workspaceFactory = new SdeWorkspaceFactory();
IWorkspace workspace = workspaceFactory.Open ("connection goes here");
0 Kudos
5 Replies
RichardWatson
Deactivated User
Suggestions:

Debug the problem in Visual Studio (or WinDbg) using unmanaged debugging with both the ESRI and Microsoft symbol servers configured.  Where is it crashing?  You could also write a console application which you run as the limited user if that helps.  SysInternals has tools which allow you to launch an application as a specific user.

Perhaps the problem is not the limited user but rather that you are trying to run with the wrong processor architecture?  I know that isn't what you said but, in my experience, this is the most common problem that people encounter.  Just add a check in the code. 

http://msdn.microsoft.com/en-us/library/system.environment.is64bitprocess.aspx

If you are using a different application pool then perhaps it is other changes that are causing the problem.

I assume that if you doing something like opening an sde connection file that the limited access user has the required permissions to access the file.  You could run the SysInternals Process Monitor tool in order to try and identify permission issues.
0 Kudos
nicogis
MVP Frequent Contributor
Extra info:
remember that SdeWorkspaceFactory is a singleton so you need use activator

http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//00010000043p000000


            Type t = Type.GetTypeFromProgID("esriDataSourcesGDB.SdeWorkspaceFactory");
            System.Object obj = Activator.CreateInstance(t);
            IWorkspaceFactory sdeWorkspaceFactory= obj as IWorkspaceFactory;

0 Kudos
JonMorris2
Frequent Contributor

If you need to use an activator, why does Esri produce samples that do not use this method?

Set Data Source Snippet

And why does it sometimes work? E.g. calling

IWorkspaceFactory workspaceFactory = new SdeWorkspaceFactory();

at 10.2 works for me, but at 10.0 it does not.

Also I can call new FileGDBWorkspaceFactoryClass() at 10.0, even though it is also a singleton.

0 Kudos
nicogis
MVP Frequent Contributor

here you can see why you need use activator: ArcObjects 10 .NET SDK Help

0 Kudos
ChrisLim
Emerging Contributor
Thank you for responses. I finally can get back to this problem from other tasks.
I believe this is permission problem more than 64bit issues. Beside crash on SdeWorkspaceFactory, it's crashing on ESRI license initialization when application pool user is in IIS_IUSRS group only. As soon as I put app pool user to administrator group, it works.
I am using Licensing code example from http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/index.html#/LicenseInitializer/0048...
and
http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/index.html#/Program/004800000226000...

Program just crashes this line on the LicenseInitializer.cs above if only user is in IIS_IUSRS group, it works if user is under adminstrator group.  It's on line 214 from the example code.
esriLicenseStatus status = m_AoInit.IsProductCodeAvailable(prod);

No logs or exception beside application log below.
Faulting application name: w3wp.exe, version: 7.5.7601.17514, time stamp: 0x4ce7a5f8
Faulting module name: AfCore_libFNP.dll_unloaded, version: 0.0.0.0, time stamp: 0x4dde4452
Exception code: 0xc0000005
Fault offset: 0x5368dc80
Faulting process id: 0x16d4
Faulting application start time: 0x01ce3ab0a5291e51
Faulting application path: C:\windows\SysWOW64\inetsrv\w3wp.exe
Faulting module path: AfCore_libFNP.dll
Report Id: 037fddf5-a6a4-11e2-a100-005056140de9


Thank you for help in advance!
0 Kudos