views:

137

answers:

1

The Web Service is in C#

From it I call by reflection a method in a dll

All happen right but when I try to replace the dll the OS says that the dll is locked. I have to finish the aspnet_wp.exe process in order to replace it.

How can I do that the Web Service does not lock the dll.

The code where I call the dll is

        string dir = "c:\\businet\\netclases\\";
        Assembly asm = Assembly.LoadFile(dir + modulo + ".dll");
        Type tipo = asm.GetType(modulo + "." + clase);
        Ipaq mod = (Ipaq)Activator.CreateInstance(tipo);

        var resp = mod.Ejecuta(paq);
+1  A: 

See this post here on Stackoverflow:

post

Colin
I replaced the code with string dir = "c:\\businet\\netclases\\"; byte[] b = File.ReadAllBytes(dir + modulo + ".dll"); Assembly asm = Assembly.Load(b); Type tipo = asm.GetType(modulo + "." + clase); Ipaq mod = (Ipaq)Activator.CreateInstance(tipo); var resp = mod.Ejecuta(paq);All right but in the last line it crash
senen