I executed the following C# code to Test environment and PROD server:
This code checks if it is able to instantiate COM classes on the servers:
开发者_高级运维 try
{
Type creatorType = Type.GetTypeFromProgID("A.B");
MessageBox.Show("Trying to create instance for :" + "A.B");
creator = (IMyInterface)Activator.CreateInstance(creatorType);
MessageBox.Show("A.B object instance is : " + creator.GetType().ToString());
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
This code is working fine on my machine, Test environment but not in PROD. On PROD, am getting an error message: "Value cannot be null.Parameter name:type" at the line :-->
creator = (IMyInterface)Activator.CreateInstance(creatorType);
The required COM dlls are installed on PROD server.What am I missing here?
Thanks.
Well, on that line, i guess only creatorType can be null. And because creatorType is returned by Type.GetTypeFromProgID, that method might returns (as MSDN says):
The type associated with the specified ProgID, if progID is a valid entry in the registry and a type is associated with it; otherwise, null.
So, it might mean that your COM dlls are not installed OK on your server. Can you find your COM dlls in the registry?
精彩评论