Ask a Question related to ASP.NET Security, Design and Development.
-
Raveendra M #1
It is not allowing build the DLL after unloading the AppDomain
Hi!
I am working with ASP.NET application. In my page I am
creating one Application Domain and in that domain I am
calling my DLL. Using the methods of the dll. And
unloading the Application Domain. Till this point it is
working fine.
My problem is, while web page is open, than I am modifying
the dll, and rebuilding. Then it is giving error:
"The file 'MyClass.dll' cannot be copied to the run
directory. The process cannot access the file because it
is being used by another process."
How do I over come this problem?
My ASPX page code is :
================================================== ========
private void Page_Load(object sender, System.EventArgs e)
{
InitMethod();
}
private void InitMethod()
{
AppDomainSetup info = new
AppDomainSetup();
info.ApplicationBase = "file:///"
+ System.Environment.CurrentDirectory;
// Create an application domain
with null evidence
AppDomain dom =
AppDomain.CreateDomain("RemoteDomain", null, info);
// Tell the AppDomain to execute
the assembly
System.Reflection.Assembly a =
System.Reflection.Assembly.LoadFrom
("D:\\Raveendra\\APPDomain\\MyClass\\bin\\Debug\\M yClass.dl
l");
object o = a.CreateInstance
("MyClass.Class1",
false,
System.Reflection.BindingFlags.Public |
System.Reflection.BindingFlags.Instance |
System.Reflection.BindingFlags.InvokeMethod,
null,
null,
null,
null);
System.Type t = o.GetType ();
Object result = t.InvokeMember
( "FindSum",
System.Reflection.BindingFlags.Public |
System.Reflection.BindingFlags.Instance |
System.Reflection.BindingFlags.InvokeMethod ,
null, o, new object [] {});
Response.Write (result);
//Call a method with arguments
object [] args = new object []
{100, 184};
Object result1 = t.InvokeMember
( "FindSum1",
System.Reflection.BindingFlags.Public |
System.Reflection.BindingFlags.Instance |
System.Reflection.BindingFlags.InvokeMethod ,
null, o, args);
TextBox1.Text = result1.ToString
() ;
AppDomain.Unload(dom);
}
================================================== ========
In brief my problem is :
when the try to build the Dll in the
path "D:\\Raveendra\\APPDomain\\MyClass\\bin\\Debug\\My Clas
s.dll", while ASP.NET page is running, it is not allowing
me. How to over come this problem, with out stoping the
IIS?
Thanks for your help.
Raveendra M Guest
-
Problem with Building DLL after the AppDomain is unloaded.
Hi! I am working with ASP.NET application. In my page I am creating one Application Domain and in that domain I am calling my DLL. Using the... -
AppDomain.UnhandledException dose note fired
Hi All I use following code to register event handler protected void Application_Start(Object sender, EventArgs e) {... -
Loading and Unloading an FLV
Greetings, I am having some trouble with the Media Component in MX Pro. I have a flash presentation built with nav buttons etc. ...... I am... -
Appdomain unloded under IIS 5.0
My application, which is a hand-coded HttpModule (not created with Visual Studio.NET) is acting inconsistently on different machines. I have a unit... -
Is there a way to unload the current appdomain?
If I have two applications that are side by side they both use the same instance of the aspnet_wp.exe. How can I unload one of these applications...



Reply With Quote

