Problem with dynamically loaded assemblies when deployed thru notouch deployment

R

Ravi

We have an application which dynamically loads an assembly and creates
instances of classes. For this we have written a factory class which
reflects the assembly and creates the classes and returns the created
objects as plain objects. The caller method casts the object returned
by the object factory into appropriate class object and uses it.

All this works fine when exe is invoked directly. But when the
application is deployed on the IIS for no touch deployment, the casting
of the object returned by the object factory is throwing an invalid
cast exception. Strange thing is that the statement that is causing
exception during run time works fine if executed in the Immediate
window of the VS.Net IDE.

How do I fix it?
 
G

Guest

Ravi I think factory class in which you are dynamically loading assemblies is
working fine on development machine because those assemblies are in Bin
Folder, but on production, i think factory is unable to locate assembly.
 
R

Ravichandra

If locating the assembly is the problem, the class object will not be
returned to the caller method. Then we will get the null reference
exception. Here the object is being returned but casting is causing the
problem. Casting is working in Immediate window during debugging but
the line of code is throwing Invalid Cast exception during execution
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top