locked
SAPI 5.4 System.IO.FileNotFoundException: Creating an instance of the COM component with CLSID RRS feed

  • Question

  • Hi,

     

    I am trying to create a windows service that will load a Speech profile dynamically using SAPI 5.4 (using SpeechLib;).I am using Windows 7 64Bit OS.

     

    For this, I have declared two objects and initialized them as below:

     

    SpSharedRecognizer SharedRecognizer;

    ISpeechObjectTokens spchObjTokens;

    SharedRecognizer = new SpSharedRecognizer();

    spchObjTokens = SharedRecognizer.GetProfiles("", "");

     

    When used the code above in a WPF application, I am able to load all trained profile description value into a string array. But it gives me the following error when I use the same code in a windows service.  I am getting the following error when I initialize the SharedRecognizer as shown below.

     

    SharedRecognizer = new SpSharedRecognizer();

     

    The error I am getting is :

     

    System.IO.FileNotFoundException: Creating an instance of the COM component with CLSID {3BEE4890-4FE9-4A37-8C1E-5E7E12791C1F} from the IClassFactory failed due to the following error: 80070002.

       at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)

       at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)

       at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)

       at System.Activator.CreateInstance(Type type, Boolean nonPublic)

       at System.Activator.CreateInstance(Type type)

       at SAPIWindowsService.SpeechRecognitionService.VoiceListenerService.LoadProfile()

     

    Is this something related with SAPI COM object or is that due to some configuration issues in the Service installer?


    Is that because service exe is not able to find the SAPI.dll in the folder where the exe of the service is located? I manually copied the dll in there but doesn’t find it.


    And also I changed the properties of Windows service installer class as follows to allow complete copy of all dependency files to the installed folder:

    Build Action to : Content

    Copy to Output Directory : Copy Always

    But this gives me following error when i try to build the application,

              ServiceListener.Dispose(bool)': no suitable method found to override

     

    Any help will be greatly appreciated.

    Thanks in advance.

     

     

    :RSMANU:
    Monday, May 30, 2011 4:42 AM