how do you know what layer ID does your web map app use?
Old classic map viewer still has some value, but new map viewer leave me in the dark on layer id
If you don't define layer id, leave layer id as blank, arcgis server will automatically assign a layer id for you. It will starting from 0, then 1, 2, ... based on drawing order. First drawing layer on the most top has layer id 0,
You can arbitrary assign a different layer id at layer property
Some time, you add 3 layers on top, then original layers id all changed by plus 3. Then you remove those 3 layers, the remaining layer id failed to minus 3 go back to original id. This is ESRI bug. unfixed. The changed layer ID cause our web map failure.
Because my web map app expecting web service layer id 0 and 1. However, now the web service layer ID secretely change to 4, 5. This mismatch cause, web map failed to drawing layer.