2
让我先解释一下这个场景。使用app.config配置Shadow Copy
我从一个安装基地安装了多个副本(说10)服务。现在我想更新其中的一个DLL。我需要停止所有的服务,更新DLL并重新启动服务。
为了避免这种情况,我在代码中使用了ShadowCopying。这样可以在不停止所有服务的情况下更新dll。它如下。
static void Main(string[] args)
{
AppDomain.CurrentDomain.SetCachePath(@"C:\Cache");
AppDomain.CurrentDomain.SetShadowCopyPath(AppDomain.CurrentDomain.BaseDirectory);
AppDomain.CurrentDomain.SetShadowCopyFiles();
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new SampleService(serviceName)
};
ServiceBase.Run(ServicesToRun);
}
现在我想实现通过app.config文件相同,具体如下,从Asp.Net
<hostingEnvironment
idleTimeout="Infinite"
shutdownTimeout="30"
shadowCopyBinAssemblies="true" />
有什么建议?
你没有说关于这个问题。你有什么问题吗?不要让我们尝试你的代码,并让我们谈论这个问题。 – Zenwalker
我试图通过配置文件来实现影子复制,就像ASP.net所做的那样。没有在代码中创建应用程序域...我被卡住了...... – Vivasaayi