Groups | Blog | Home
all groups > dotnet component services > october 2007 >

dotnet component services : .net 2 Enterprise Services components instantiate incorrect type


F Atos
10/24/2007 6:07:01 AM
We have a solution that was built using .net 1.1 and Visual Studio 2003. I am
trying to upgrade it to .net 2.0 and am also using Visual Studio 2005.

Under .net 1.1, the components successfully installed into Enterprise
Services using a ‘Lazy Install’ – when the components are run for the first
time they were automatically installed. However under .net 2, only some
components appear. I observe the following error:
System.InvalidCastException: CoCreateInstance returned an unexpected type:
expected <Class_A>, received <Class_B>.

This error is occurring within Class_B, an Enterprise Service component,
when instantiating Class_A, another Enterprise Service component within the
same package.
public Class_B
...
dim a as Class_A = new Class_A

During debugging, instead of an object of Class_A being instantiated, the
class being created is the calling class, which then can not be assigned to
the variable of type Class_A.

In VS2005 I recreated the solution, projects and copied source code from
..net 1.1 solution, and initially the lazy install seemed to be working,
however it then broke again.

This problem can be solved by using regsvcs to manually install the
components, however is there a way to get them to install automatically?
Terry
11/15/2007 7:40:03 AM
I am having this exact problem too. Hopefully MS can provide an answer.

[quoted text, click to view]
AddThis Social Bookmark Button