2 Replies Latest reply on Jan 24, 2017 9:12 AM by Amen Allah Jlili

    Cannot connect to SolidWorks through Windows Service

    A. B.

      Hello, I am having a difficulty creating an instance of SolidWorks through C#.NET when I am calling it either from a windows service or from a web service. 


      The code is very simple –             




           SldWorks.SldWorks swApp = new SldWorks.SldWorks();               


      catch (Exception ex)           


           Logger.WriteErrorLog("Connection failed : " + ex.Message);            



      The exception message is - Retrieving the COM class factory for component with CLSID {F16137AD-8EE8-4D2A-8CAC-DFF5D1F67522} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).  This is the same for both the projects.  The same code works perfectly fine, when I try to launch a SolidWorks from a windows forms application or console application.  Could you please let me know what needs to be done in order to get this working for WebAPI or Windows Service? I am using Visual Studio 2015 to create a WebAPI project or Windows Service project.