Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have several feature classes and a lot of services. When I try to make my feature class versioned I get the message that the feature class is locked which is obvious. But it's not telling me by which service it's locked.

Is there a possibility to work through all feature classes with ARCPY and find out in which service it's referenced?

Thnxs for all answers!

share|improve this question
add comment

1 Answer 1

ArcGIS Server 10.1+:

You can do this, however there is no out-of-the-box functionality for this. The information about what feature classes are used (and from what database files they are coming) is not exposed via ArcGIS Server Manager / Services Directory / REST Admin.

However, this information is stored as service metadata within C:\arcgisserver\directories\arcgissystem\arcgisinput\ServicePaths.MapServer\extracted folder in manifest.xml file (there are both .json and .xml). .Xml file contains more detailed information, I recommend parsing this file (but you could start with .json first to get the idea).

Two tags you should look at in .xml file are <Name>ServicePaths</Name> - service name and multiple <OnPremisePath>C:\GIS\Temp\test.gdb\StopsSandiego</OnPremisePath> tags which will contain feature classes names and their catalog/geodatabase path.

Code wise, you could use Python to parse this .xml file, get a dictionary with this structure:

{str:(tuple)} #data type

{servicename:(featureclasspath)} #pseudocode
{servicename:(fc1,fc2,fc3); servicename1:(fc1,fc2); servicename2:(fc5);...} #pseudocode

When you are done with that, you can write a function that will return the key of the dictionary (servicename) based on the value (feature class path name you supply). This will let you know what services you should stop to release the lock to the feature class.

ArcGIS Server 10.0:

Go to C:\Program Files (x86)\ArcGIS\Server10.0\server\user\cfg and open the .cfg file associated with your service. Look for the <FilePath> tag. Now you can iterate through all .cfg files in this folder with Python and get information on what .mxd files are used and since you have access to the .mxd you can get each layer data source path and thus feature class names.

<ServerObjectConfiguration>

    <Description></Description>

    <Properties>
        <FilePath>D:\temp\TempService.mxd</FilePath>
share|improve this answer
    
Alex, thanxs for the answer. I understand it but it looks to me that you're answer is related to version 10.1. I'm working with 10.0 (;-() and can't find that directory structure exactly and the xml file. Any hints? Thnxs!! –  user32324 Jun 13 at 7:46
    
Ah I see. I've modified my answer to meet your needs. –  Alex Tereshenkov Jun 13 at 16:12
    
Alex, thanxs again for your answer. It's clear to my now and can advance with my "search". –  user32324 Jun 17 at 9:50
add comment

Your Answer

 
discard

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.