I am developing a system where user interacts with WCF Service hosted in IIS server. The WCF application then have to fire-up winform application along with some parameters. This winform application do some processing and then load a Solidworks application(software) installed on the server. This Solidworks will create some output files and put it in the share-able folder where user has a access to.
It is working fine in development environment (Visual Studio) but when I deployed it in IIS, it throws following error:
COMException was unhandled An unhandled exception of type System.Runtime.InteropServices.COMException' occurred in mscorlib.dll
I tried loading the WinForm using two methods:
- Winform is loaded creating a instance of WinForm from WCF host
- Executable of WinForm is loaded (.EXE) using System.Diagnostics.Process.Start()
I tried following:
- Running IIS under domain admin identity
- Disabling UAC
Both operation failed. I tried giving AppPool "Local System“ and “Doman admin” identity but doing that It started throwing me visual studio runtime exception “ An unhandled exception of type System.Runtime.InteropServices.COMException' ". I tried converting the program into x86 too but it did not work. But when I run the application independently, it is working fine.
When I tried debugging, it is not working in this line:
<span class="typ" style="color: #2b91af;">SldWorks</span><span class="pln" style="color: #000000;"> swApp </span><span class="pun" style="color: #000000;">=</span><span class="pln" style="color: #000000;"> </span><span class="typ" style="color: #2b91af;">Activator</span><span class="pun" style="color: #000000;">.</span><span class="typ" style="color: #2b91af;">CreateInstance</span><span class="pun" style="color: #000000;">(</span><span class="typ" style="color: #2b91af;">Type</span><span class="pun" style="color: #000000;">.</span><span class="typ" style="color: #2b91af;">GetTypeFromProgID</span><span class="pun" style="color: #000000;">(</span><span class="str" style="color: #800000;">"SldWorks.Application"</span><span class="pun" style="color: #000000;">))</span><span class="pln" style="color: #000000;"> </span><span class="kwd" style="color: #00008b;">as</span><span class="pln" style="color: #000000;"> </span><span class="typ" style="color: #2b91af;">SldWorks</span><span class="pun" style="color: #000000;">;</span><span class="pln" style="color: #000000;"> </span>SolidworksApi macros