zoukankan      html  css  js  c++  java
  • 控制bin文件夹里面的dll不复制到临时目录中( <hostingEnvironment shadowCopyBinAssemblies="false" />)

    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 in 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 in directory, and loads the DLLs from the copy. ASP.NET monitors the in 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 in directory (a good reason never to store anything but DLLs in in).


    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 in 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,则需要将应用程序脱机或停止该过程,然后才能这样做。

  • 相关阅读:
    聚美优品面试题
    前端开发常用的网站
    JS 正则表达式大全
    软件工程作业二
    大三个人简述
    2019期末总结
    2019春第一次课程设计实验报告
    2019第十二周作业
    2019第十一周作业
    2019第十周作业
  • 原文地址:https://www.cnblogs.com/lip-blog/p/8663075.html
Copyright © 2011-2022 走看看