1. 程式人生 > >控制bin文件夾裏面的dll不復制到臨時目錄中( <hostingEnvironment shadowCopyBinAssemblies="false" />)

控制bin文件夾裏面的dll不復制到臨時目錄中( <hostingEnvironment shadowCopyBinAssemblies="false" />)

制作 lock for 被鎖 update access AC pos 選項

One of the things that makes developing ASP.NET applications very cool is that you can rapidly prototype, tweak, and update your application, without having to stop and restart the web server. This includes assemblies (DLLs) used by your application for things like business logic and/or data access. You can simply drag and drop a new copy of a DLL into the \bin directory, and ASP.NET will automatically start using the new DLL with the next request.


The way that this works is that ASP.NET makes a shadow copy of the contents of the \bin directory, and loads the DLLs from the copy. ASP.NET monitors the \bin directory for changes, and repeats the shadow copy when the contents change.


While this is very convenient, it does take time, and if you have a large number of DLLs, or very large DLLs, the shadow copy process can potentially impact application startup and restart performance. This is also true if you have non-dll content in the \bin directory (a good reason never to store anything but DLLs in \bin).


So in some situations, you might want to turn off the shadow copy process. To do this, add the following to your ASP.NET 2.0 web.config file:

<hostingEnvironment shadowCopyBinAssemblies="false" />

While this will reduce performance overhead associated with shadow copying the contents of the \bin directory, do keep in mind that using this configuration option will result in the DLLs being locked when the app is running. So if you need to update a DLL, you will need to take the application offline or stop the process before you can do so.

使開發ASP.NET應用程序非常酷的一件事是,您可以快速原型,調整和更新應用程序,而無需停止並重新啟動Web服務器。這包括您的應用程序用於業務邏輯和/或數據訪問等的程序集(DLL)。您可以簡單地將一個DLL的新副本拖放到\ bin目錄中,ASP.NET將在下一個請求時自動開始使用新的DLL。


這樣做的方式是ASP.NET為\ bin目錄的內容制作影子副本,並從副本加載DLL。 ASP.NET監視\ bin目錄中的更改,並在內容更改時重復卷影副本。


雖然這非常方便,但確實需要時間,並且如果您有大量DLL或非常大的DLL,則影子復制進程可能會影響應用程序啟動和重新啟動性能。如果您的\ bin目錄中有非dll內容(這是一個很好的理由,除了dll之外,\ bin不要存儲非dll任何內容)。


所以在某些情況下,您可能需要關閉卷影復制過程。為此,請將以下內容添加到ASP.NET 2.0 web.config文件中:

<hostingEnvironment shadowCopyBinAsmblies =“false”/>

雖然這會減少與拷貝\ bin目錄的內容相關的性能開銷,但請記住,使用此配置選項將導致應用程序運行時DLL被鎖定。因此,如果您需要更新DLL,則需要將應用程序脫機或停止該過程,然後才能這樣做。

控制bin文件夾裏面的dll不復制到臨時目錄中( <hostingEnvironment shadowCopyBinAssemblies="false" />)