I have called Matlab functions from C# using COM objects. It runs but on multiple calls it gives an exception while instantiating matlab Engine Interface through COM.
//for instantiating MATLAB Engine Interface through COM
MLApp.MLAppClass matlab = new MLApp.MLAppClass();
Exception it gives:
Unable to cast COM object of type 'MLApp.MLAppClass' to interface type 'MLApp.DIMLApp'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{669CEC93-6E22-11CF-A4D6-00A024583C19}' failed due to the following error: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA).
I'm unable to figure this out. Any help will be appreciated.