I would like to know how can I find out if the layer IDs are fixed in mxd through ArcObjects? I usually use the code below to find the layer ids in mxd:
IMapDocument mapDocument = new MapDocumentClass();
IMap b = mapDocument.get_Map(0);
ILayerExtensions c = b.get_Layer(0) as ILayerExtensions;
IServerLayerExtension g = c.get_Extension(0) as IServerLayerExtension;
IPropertySet psN = new PropertySet();
But when the ids are not fixed the returned Layer ID is wrong, because it follows the order of the layers included in the mxd.
By fixed ids i mean the configuration of Data Frame Properties General tab, when you check the box "Allow assignement of unique numeric IDs for map service publishing"