serverobject becomes null in SOI

1266
2
06-08-2021 07:18 AM
Labels (1)
AndreasRuloffs2
New Contributor II

Hi,

I have written an SOI for rights management in c# and let it run on ArcGIS server 10.7.1.

Normally it is working good, but sometimes the Service becomes unavailable. In the Log files I find the message:

 

 

 

<Msg time="2021-05-31T10:13:27,277" type="SEVERE" code="9000" source="Rest" process="4724" thread="1" methodName="" machine="MU-KARTENSRV.REGIONHANNOVER.DE" user="" elapsed="" requestID="feed7716-61c9-4107-ad25-5133bfcc1d58">Error performing query operation Error handling service request :0x80004003 - Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt. in 'GlobalNetXXSOI'</Msg>

 

 

 

The error message says, that there is a null pointer.

The translation of the germen massage should be: 

"Object reference not set to an instance of an object"

I have a class attribute:

 

 

 

private IServerObject serverObject;

 

 

 

 Like in the esri samples it is filled in the init method:

 

 

 

    public void Init(IServerObjectHelper pSOH)
        {
            try
            {
                serverObject = pSOH.ServerObject;
            }
            catch (Exception e)
            {
                logger.LogError(e);
                Logger.WriteSystemError(e.ToString());
            }
        }

 

 

 

 But now it seems, that this attribute becomes null some times. Is there any way I could get the ServerObject, outside the Init method, so I could restore it, when it becomes null?

Best regards,

Andreas Ruloffs

Tags (2)
0 Kudos
2 Replies
nicogis
MVP Frequent Contributor

get IServerObjectHelper in init

The server object helper implements a weak reference on a server object such that a server object extension can keep a string reference on the server object helper (for example, in a member variable) and avoid keeping a strong reference on the server object itself.

0 Kudos
AndreasRuloffs2
New Contributor II

Thank you for your answer,

OK, so I will change it, that I keep the helper in a member and access the serverObject from it.

But I am afraid, this wont fix my problem, cause I had the problem when I had solved it this way some time ago.

 

0 Kudos