控制bin文件夾裏面的dll不復制到臨時目錄中( )

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.web


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.api


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:app

 

<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.this

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


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


雖然這很是方便,但確實須要時間,而且若是您有大量DLL或很是大的DLL,則影子複製進程可能會影響應用程序啓動和從新啓動性能。若是您的\ bin目錄中有非dll內容(這是一個很好的理由,除了dll以外,\ bin不要存儲非dll任何內容)。orm


因此在某些狀況下,您可能須要關閉卷影複製過程。爲此,請將如下內容添加到ASP.NET 2.0 web.config文件中:server

 

<hostingEnvironment shadowCopyBinAsmblies =「false」/>

雖然這會減小與拷貝\ bin目錄的內容相關的性能開銷,但請記住,使用此配置選項將致使應用程序運行時DLL被鎖定。所以,若是您須要更新DLL,則須要將應用程序脫機或中止該過程,而後才能這樣作。

相關文章
相關標籤/搜索