There was an environment where virtual machine dispose tasks were stuck and they were repeating dispose tasks every 2.5 hours
Agents were throwing exception stating
Exception occured when retrieving work item from Manager Service: System.ServiceModel.CommunicationException: The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.
The calls are failing because agent is unable to read the workitems.
There is a default maximum size of 65536 on incoming workitems.If the machines being deployed or destroyed have enough custom properties to swell workitem size beyond the maximum allowed value then these sort of exceptions happen
To fix this, need to edit VRMAgent.exe.config and locate this block ( Proxy Agent Location )
<bindings> <basicHttpBinding> <binding name="BasicHttpBinding_VMPSProxyAgent"> <security mode="TransportWithMessageCredential"> <message clientCredentialType="Certificate" /> </security> </binding> </basicHttpBinding> </bindings>
and change the line that reads
<binding name="BasicHttpBinding_VMPSProxyAgent" maxReceivedMessageSize="1310720">
Then restart the proxy agent where the issue is seen. This exception should now go away and any virtual machines in stuck states will clear over a period of time during it's retry cycle