Error: Retriving the COM class factory for compone

2019-08-27 22:04发布

I have a c# winforms application which i use to send audio out form a camera, which uses third party dll for connecting to device and sending audio out to device. when i run my application on my local machine then everything runs fine without any problem. Problem: But when i copy my application onto another machine and run it i getting this error Unable to send audio to this device. Error: Retriving the COM class factory for component with CLSID failed due to following error : 80040154 (Exception HResult): 0x80040154(REGDB_E_CLASSNOTREG).

Please any one who knows can tell me what exaclty this error means and what is the possible chances of happening this error on another machine it when i run it.

My code for connecting to device and sending audio out to device is -

    [NonSerialized]
    public Bosch.VideoSDK.Live.AudioOutput audioOutput = null;
    [NonSerialized]
    private Bosch.VideoSDK.AudioLib.AudioSourceClass audioSource = null;    
    [NonSerialized]
    private Bosch.VideoSDK.Device.DeviceProxy deviceProxy = null;    
    [NonSerialized]
    private Bosch.VideoSDK.AudioLib.AudioSourceClass audioSource = null; 

    private bool ConnectDeviceAndStartSendingAudioOut(ref string error)
    {           
        bool connectResult = true;
            try                                  // Connect to the device using a URL that we build.  
            {                    
                error = string.Empty;
                if (Camera.Camera_UserName != "" && Camera.Camera_Password != "")
                {
                    deviceUrl = string.Format("{0}:{1}@{2}", Camera.Camera_UserName, Camera.Camera_Password, this.Camera.Get_Default_IP());
                }
                deviceConnector = new Bosch.VideoSDK.Device.DeviceConnector();
                deviceConnector.DefaultTimeout = 2000;  
                audioSource = new Bosch.VideoSDK.AudioLib.AudioSourceClass();
                audioSource.SelectDevice(0);
                audioSource.EnableInput(0, true);                                         

                // Establish the connection synchronously.                                                                  
                deviceProxy = deviceConnector.Connect(deviceUrl, "");
                if(deviceProxy == null)
                {
                    return false;
                }
                switch (deviceProxy.ConnectionState)
                {
                    case Bosch.VideoSDK.Device.ConnectResultEnum.creInitialized:
                    case Bosch.VideoSDK.Device.ConnectResultEnum.creConnected:
                         //StartAudioInput();
                         StartAudioOutput();
                         connectResult = true;
                         break;
                    default:
                        DisconnectDevice();
                        connectResult = false;
                        break;
                }                                      
            }
            catch (Exception ex)
            {
                ExceptionHandler.handleException(ex);
                error = ex.Message;
                connectResult = false;
            }            
        return connectResult;
    }        

  private void StartAudioOutput()
    {
        Bosch.VideoSDK.Live.AudioOutputs aoAudioOutCol = deviceProxy.AudioOutputs;
        if (aoAudioOutCol != null)
        {
            foreach (Bosch.VideoSDK.Live.AudioOutput ao in aoAudioOutCol)
            {
                audioOutput = ao;
                SetAudioOutputToSource();                                                   
            }
        }
    }                
    private void SetAudioOutputToSource()
    {
        audioOutput.SetStream(audioSource.Stream); 
    }

The third party dll that connects to device is - enter image description here

My project is buit for .net framework version 4.6 and application is buit for x86 and dlls version is also version 4.6 and built x86.

I have set Embed interop type to false.

I have tried various solutions to solve this like cleared compomentmodelcache before build of appication, but problem exists. I inspect that their may be problem related to dll DeviceConnectorClass GUID attribute with windows registry.

Thankyou!

0条回答
登录 后发表回答