richardmarcell

Exception thrown casting web page state variable to PISDK.Server object - can't load dll/type library

Discussion created by richardmarcell on Aug 23, 2013
Latest reply on Sep 4, 2013 by mhamel

I have a web application I'm trying to support (didn't write it) which in the Application_BeginRequest method is getting the default pi server object and saving it in a state variable, code follows:

 

            try {
                if (g_piServer == null) {
                    if (g_SDK == null) {
                        g_SDK = new PISDK.PISDKClass();
                    }
                    if (g_piServers==null) {
                        g_piServers=g_SDK.Servers;
                        Application["piServers"] = g_piServers;
                    }
                    g_piServer = g_SDK.Servers.DefaultServer;
                }
            } catch (Exception ex) {
                Application["errState"] = "GetServObj: " + ex.Message;
                Application.Remove("piServer");
            }

 

            if (!g_piServer.Connected) {
                try {
                    g_piServer.Open(g_piServer.Name);
                    Application["piServer"] = g_piServer;
                } catch (Exception ex) {
                    Application["errState"] = "OpenServer: " + ex.Message;
                    Application.Remove("piServer");
                }
            }

 

When a subsequent Page_Load method is called, this line of code:

 

srv = (PISDK.Server)_ctx.Application["piServer"];

 

produces the following error:

 

Unable to cast COM object of type 'System.__ComObject' to interface type 'PISDK.Server'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{3BCB2DC6-5F66-11D1-BD64-0060B0290178}' failed due to the following error: Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)).

 

This is only happening on one machine. On several others, the application is working just fine.

 

 

 

Any ideas?

 

Thanks.

Outcomes