473,326 Members | 2,124 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,326 software developers and data experts.

shadow copying

I am trying to use shadow copying provided by the framework, but I am not
able to get it to work. More specifically, after a new app domain is created
and the assembly loaded in it, it is still not possible to replace the
original DLL although it has been shadow copied to the cache folder. I need
to be able to replace plug-in DLLs while the server is running. I guess that
is what shadow copying exists for, but the DLL is locked until the app
domain has been unloaded (which fully beats the purpose of this "exercise").
Furthermore, if I comment out the line that adds the 'bin' folder to current
domain's list of private paths the assembly is not found at all, although
the new domain I am trying to load it in has its privatebinpath set to
include the 'bin' folder. Weird.

Someone please enlighten me. Thanks.

Code:
//----------------------------------------------------
cut --------------------------------------------
using System;
using System.IO;
using System.Reflection;
using System.Security.Policy;

namespace Test
{
class shadowCopying
{
public static void Main()
{
AppDomainSetup setup = new AppDomainSetup();
setup.ApplicationBase =
"d:\\development\\c#\\test\\shadowCopying\\";
setup.ApplicationName = "ShadowCopy";

setup.PrivateBinPath = setup.ApplicationBase + "bin";
setup.ShadowCopyDirectories = setup.ApplicationBase + "bin";
setup.ShadowCopyFiles = "true";

AppDomain.CurrentDomain.AppendPrivatePath("bin");

Evidence evidence = new
Evidence(AppDomain.CurrentDomain.Evidence);
AppDomain domain = AppDomain.CreateDomain("DynamicLoad",
evidence, setup);

string cachePath = domain.BaseDirectory + "cache";

DirectoryInfo dir = new DirectoryInfo(cachePath);
if(dir.Exists)
dir.Delete(true);

domain.SetCachePath(cachePath);

Assembly assembly = domain.Load("dynamicLoad");

Console.WriteLine("Waiting for any key....");
Console.ReadLine();
}
}
}
//---------------------------------------------
cut --------------------------------------------------

--
Mr 071, MCSD.NET, MCAD.NET
Nov 15 '05 #1
0 2359

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

Similar topics

5
by: Bill Rust | last post by:
I have a component that needs to access files which exist in the same directory as the DLL containing the component itself. To determine the component's installation directory, I'm using...
0
by: surya | last post by:
Hi, I need to enable shadow copying network share folder assemblies. Currently if the path is given as the network share folder path, shadow copying is not enabled. Should something special be...
2
by: Alex | last post by:
Is this correct: 1. When the first request for an application on the virtual directory comes in and ASP.NET worker process creates an AppDomain for that particular application, it copies the...
4
by: Barry Kelly | last post by:
I'm designing an application framework which will, amongst other things, live in an assembly hosted in the ASP.NET worker process, servicing webservice requests. Here's the scenario: APPFX is...
0
by: Damien Anselmi | last post by:
I am using the CompileAssemblyFromSource method of an ICodeCompiler instance to dynamically compile an assembly used by a Web Application. The assembly may be recompiled any number of times during...
2
by: Oenone | last post by:
I have an application which loads plugin DLLs from various directories on the local disk. To avoid problems with the DLLs being locked by IIS, I have modified my code so that it copies the DLLs to...
4
by: Michael Nemtsev | last post by:
Use Win2003 Server and VS 2003. When I'm trying to debug COM+ lib, I've stumble over ShadowCopying feature, when my dll being copied in temporary folder, and I can't step in my dll. No breakpoits...
5
by: mark_overstreet | last post by:
I have a generic data layer DLL that expects to read its connection string from it's own config file. The dll and config file have been placed in the bin directory (VS.NET2005). However, due to...
9
by: CMM | last post by:
I've been scouring the net for the last few days looking for a way to copy a locked file (create a shadow volume, expose it... that's it) from within my program. I'm aware of the kludgy vshadow.exe...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.