G
Guest
This code works great in a windows application:
// Dynamically load the DLL
sDLLName = "..\\bin\\Test2.dll";
Assembly objAssembly = System.Reflection.Assembly.LoadFrom(sDLLName);
// Create an instance of the class
object testObject = objAssembly.CreateInstance("Test2.Test");
// Call the method "TestMessage" which has one argument
object[] object2 = new object[1];
object2[0] = 200;
MethodInfo Method = testObject.GetType().GetMethod("TestMessage");
object result = Method.Invoke(testObject, object2);
// This should return 300 and does
Console.WriteLine(result.ToString());
However, from a web service project, I can't seem to get this to work. It
can't find the DLL.
Questions:
* Does IIS sandbox the project and not allow external references?
* Is there a special way that IIS needs set up to allow this?
* I assume that IIS works with server paths, so maybe the path I have
specified above does not work. Should I be using a different path variable?
* Does IIS shadow the web service files to another location making this
approach impossible?
Any help is most appreciated!
Thanks!
Michael
// Dynamically load the DLL
sDLLName = "..\\bin\\Test2.dll";
Assembly objAssembly = System.Reflection.Assembly.LoadFrom(sDLLName);
// Create an instance of the class
object testObject = objAssembly.CreateInstance("Test2.Test");
// Call the method "TestMessage" which has one argument
object[] object2 = new object[1];
object2[0] = 200;
MethodInfo Method = testObject.GetType().GetMethod("TestMessage");
object result = Method.Invoke(testObject, object2);
// This should return 300 and does
Console.WriteLine(result.ToString());
However, from a web service project, I can't seem to get this to work. It
can't find the DLL.
Questions:
* Does IIS sandbox the project and not allow external references?
* Is there a special way that IIS needs set up to allow this?
* I assume that IIS works with server paths, so maybe the path I have
specified above does not work. Should I be using a different path variable?
* Does IIS shadow the web service files to another location making this
approach impossible?
Any help is most appreciated!
Thanks!
Michael