473,385 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Releasing a loaded assembly in ASP.NET 2.0

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
Jan 9 '06 #1
2 1512
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" <oe****@nowhere.com> wrote in message
news:ez**************@TK2MSFTNGP09.phx.gbl...
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

Jan 9 '06 #2
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
Jan 9 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: aerobar2 | last post by:
When I debug my application I get "no symbols loaded" ================= 'DefaultDomain': Loaded 'c:\winnt\microsoft.net\framework\v1.1.4322\mscorlib.dll', No symbols loaded. 'MHSFire': Loaded...
2
by: asdf | last post by:
Hello, I was enjoying working in VS for half a year without any problems and now I cannot debug anymore. Without any really reason my Studio tells me that the page that I want to debug has - No...
1
by: Zachary Hartnett | last post by:
I was trying to write a routine this morning that would open a given assembly, walk the inheritance tree of classes in the assembly, and provide a list of classes in the assembly that inherit from...
1
by: Sender | last post by:
Everytime I run a form, in the output window I get the following: 'DefaultDomain': Loaded 'c:\winnt\microsoft.net\framework\v1.0.3705\mscorlib.dll', No symbols loaded. 'WindowsApplication5':...
0
by: RDI | last post by:
What's it mean? My prog runs fine. Then as soon as I press ok or cancel, the following is what's in the output area of the debugger. TIA -- RDI (remove the exclamation from the email...
2
by: Oenone | last post by:
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...
1
by: =?Utf-8?B?S29lcnQ=?= | last post by:
Hi, I try to load an assembly, use it and then release it. I am wondering if there is a way to release the assembly? I've read that if you use the current AppDomain this is not possible, so you...
2
by: Smithers | last post by:
I have a Windows Forms application that implements a plug-in architecture whereby required assemblies are identified and loaded dynamically. Here are the relevant classes: A = application =...
1
by: Jordan S. | last post by:
I plan to load an assembly during application startup, and load that assembly via reflection (i.e., it isn't referenced in the application's assembly manifest). The assembly will be loaded into the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.