Web程序中不能使用反射
public Object createInstance(String strCan)
{
Assembly vAss;
Object result;
String dllName, className;
String strFile;
String[] arrayCanPart;
try
{
arrayCanPart = getArray(strCan);
dllName = arrayCanPart[0];
className = arrayCanPart[1];
strFile = this.m_missionOn.workPath + @"" + dllName;
if (File.Exists(strFile) == false)
{
strFile = this.m_missionOn.workPath + @"\Bin" + dllName;
}
vAss = Assembly.LoadFile(strFile);
result = vAss.CreateInstance(className);
}
catch (Exception e1)
{
Msg m1;
m1 = m_missionOn.msgMaker.createMsg("Com1.MsgError.CreateInstanceError");
m1.Data["Can"] = strCan;
m1.Data["Cause"] = e1.Message;
throw m1;
}
return result;
}