Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Releasing a loaded assembly in ASP.NET 2.0

Reply
Thread Tools

Releasing a loaded assembly in ASP.NET 2.0

 
 
Oenone
Guest
Posts: n/a
 
      01-09-2006
I've an ASP.NET 2.0 project into which various Plug-In DLLs can be
installed. I'm running it in the ASP.NET Development Server. In order to
load one of the PlugIn DLLs I'm using
System.Reflection.Assembly.LoadFrom(filename) to load the DLL and then
calling CreateInstance on the assembly that is returned.

This is all fine, but when I stop the project from running, change the code
and then re-compile it, I'm frequently getting a message from the compiler
as follows:

\\\
Unable to copy file "obj\Debug\Plugin.dll" to "bin\Plugin.dll". The process
cannot access the file "bin\Plugin.dll" because it is being used by another
process.
///

The only way I've found to get past this is to right-click the ASP.NET
Development Server icon in the system tray and tell it to Stop. This gets
extremely tedious after a while.

Is there any way to programmatically release the loaded plugin assemblies
once I've finished using them? I can't find any method on the Assembly
object that looks like it may facilitate this.

Failing that, can anyone suggest any other method of stopping the
development server from locking the DLL, so that subsequent builds can be
copied over the top of it?

Many thanks,

--

(O)enone


 
Reply With Quote
 
 
 
 
Oenone
Guest
Posts: n/a
 
      01-09-2006
Hi Cesar,

> This happens because the IIS locks any referenced dll when utilized
> for first time.


Thanks for the reply, but I'm not actually using IIS, but the ASP.NET
Development Server instead. I was expecting that the DevServer would close
itself down each time I stopped debugging my project, but that doesn't seem
to be happening...

--

(O)enone


 
Reply With Quote
 
 
 
 
Cesar Ronchese
Guest
Posts: n/a
 
      01-09-2006
This happens because the IIS locks any referenced dll when utilized for
first time. What you can do is build a .bat that have the following
commands:

net stop w3svc
net stop msftpsvc
net stop smtpsvc
net stop iisadmin

net start iisadmin
net start smtpsvc
net start msftpsvc
net start w3svc

pause


You can double-clicks it everytime you need recompile your dll or execute it
via macro inside Visual Studio.

There is another way, configuring the IIS to don't lock the dlls, but you
need search for it in Google. This other way sometimes still locks the dll,
in some circunstancies. I can't remember which, because long ago I used it.


[]s
Cesar






"Oenone" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I've an ASP.NET 2.0 project into which various Plug-In DLLs can be
> installed. I'm running it in the ASP.NET Development Server. In order to
> load one of the PlugIn DLLs I'm using
> System.Reflection.Assembly.LoadFrom(filename) to load the DLL and then
> calling CreateInstance on the assembly that is returned.
>
> This is all fine, but when I stop the project from running, change the
> code and then re-compile it, I'm frequently getting a message from the
> compiler as follows:
>
> \\\
> Unable to copy file "obj\Debug\Plugin.dll" to "bin\Plugin.dll". The
> process cannot access the file "bin\Plugin.dll" because it is being used
> by another process.
> ///
>
> The only way I've found to get past this is to right-click the ASP.NET
> Development Server icon in the system tray and tell it to Stop. This gets
> extremely tedious after a while.
>
> Is there any way to programmatically release the loaded plugin assemblies
> once I've finished using them? I can't find any method on the Assembly
> object that looks like it may facilitate this.
>
> Failing that, can anyone suggest any other method of stopping the
> development server from locking the DLL, so that subsequent builds can be
> copied over the top of it?
>
> Many thanks,
>
> --
>
> (O)enone
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access is denied - assembly could not be loaded joserobenator@gmail.com ASP .Net 1 06-05-2005 03:13 AM
the assembly 'ASPnetMenu' could not be loaded... =?Utf-8?B?QXNoYQ==?= ASP .Net 1 04-09-2005 09:29 AM
Assembly could not be loaded??? KK ASP .Net 1 04-12-2004 01:41 PM
java -verbose doesn't show "loaded from" for classes loaded from custom jars in the classpath Udo Corban Java 0 01-23-2004 09:32 AM
Re: how to programatically give assembly loaded from network the same trust as those loaded from local host? Marcelo Birnbach [MS] ASP .Net 0 06-27-2003 11:51 PM



Advertisments