TypeLoadException, when trying to access type in appdomain
Im trying to load an assembly(In code), and get a type from it.
I do it in this way:
AppDomain.CurrentDomain.Load(serviceassembly.GetName);
host = New ServiceHost(Type.GetType(node.Attributes("name").InnerText,True, True));
But the last line, throws me this exception:
System.TypeLoadException was unhandled
Message="Could not load type Service.Service1' from assembly Service, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'."
Anyone ever encountered this? Or can see what im doing wrong?
Cheers
[583 byte] By [
Chadk] at [2007-12-25]
I don't believe you've posted enough code to come to a precise solution but something that strikes me as funny is why you are loading an assembly that is already loaded? If you have serviceassembly as an Assembly then how did you load it? Once it is loaded you don't need to load it again into the current app domain. You can use the GetType method to get the type you want.
Nevertheless the problem is that the type you specified Service.Service1 can not be found. Verify the full name, verify the assembly is loaded properly, etc.
Michael Taylor - 10/2/06