什么时候一个ASP.NET网站项目重新编译? [英] When does an ASP.NET Website project recompile?

查看:144
本文介绍了什么时候一个ASP.NET网站项目重新编译?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于 Maurico 并的 codeKA 首先指出,不要使用默认的是InProc会话的,如果你不想被重新编译的网站和应用回收受到影响您的会话执行。

As Maurico and codeka first stated, don't use the default InProc sessions if you don't want your sessions to be affected by website recompiles and application recycles.

是什么原因导致整个网站的重新编译列表:

A list of what causes whole website recompile:


  1. 在默认情况下,当任何更改到的顶层文件的网站中取得,整个网站被重新编译。顶层文件包括在 Global.asax中文件和所有文件在斌/ APP_ code / 文件夹。

  1. By default, when any change is made to a top-level file in a Web site, the whole site is recompiled. Top-level files include the global.asax file and all files in the bin/ and App_Code/ folders.

的web.config

配置包括文件的变化,如果在<一个href=\"http://msdn.microsoft.com/en-us/library/system.configuration.sectioninformation.restartonexternalchanges.aspx\"相对=nofollow> SectionInformation.RestartOnExternalChanges财产是真正

a configuration include file change, if the SectionInformation.RestartOnExternalChanges property is true

&lt;节
    NAME =MyAppSettings
    键入=System.Configuration.AppSettingsSection,System.Configuration,版本= 2.0.0.0,文化=中性公钥= b03f5f7f11d50a3a
     restartOnExternalChanges =真正
    requirePermission =FALSE/&GT;

<section name="MyAppSettings" type="System.Configuration.AppSettingsSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" restartOnExternalChanges="true" requirePermission="false" />

注:


  • 如果您希望能够更改顶层文件,而不会导致重新编译整个网站,您可以设置<一个href=\"http://msdn.microsoft.com/en-us/library/system.web.configuration.compilationsection.optimizecompilations.aspx\"相对=nofollow> optimizeCompilations在Web.config文件属性编译元素为true

  • If you want to be able to change top-level files without causing the whole site to be recompiled, you can set the optimizeCompilations attribute of the compilation element in the Web.config file to true

参考文献:

  • Understanding ASP.NET Dynamic Compilation

在哪儿,告诉该种变化,造成网站项目文件的信息(而不是Web应用程序项目)重新编译自己?

Where's the info that tells the kinds of changes and files which cause a website project (not web application project) to recompile itself?

我问的原因是因为我们不希望用户失去他们的会话。因此,我们要更新直播网站,只在上午的非常凌晨重新编译变化,但将preFER在白天进行更改,以加快他们。我们提升到一个临时服务器第一,看它存在,但一个确定的名单将提前是很好的。

The reason I'm asking is because we don't want users to lose their sessions. Therefore we want to update the live website with recompilable changes only in the very wee hours of the morning, but would prefer to make changes during the day to expedite them. We do promote to a staging server first and watch it there, but a definitive list would be nice in advance.

推荐答案

您会失去会话不只是当你的网站是重新编译,还当IIS工作进程被回收。从技术上讲,可以在任何时间发生的 的(也有方法,尽量减少它,但我preFER建筑师的应用程序,能够生存的工作进程反正回收),所以如果会议是很重要的,那么你真的需要被存储它们外的过程

You'll lose sessions not just when your website is recompiled, but also when the IIS worker process is recycled. Technically, that can happen at any time (there are ways to minimise it, but I prefer to architect applications that can survive worker process recycles anyway), so if sessions are important then you really do need to be storing them out-of-process.

ASP.NET自带这只是存储会话状态的一个窗口服务内置状态服务器。另一种选择是使用SQL Server会话状态存储。

ASP.NET comes with a built-in "state server" which is just a windows service that stores session state. Another option is to use the SQL Server session state storage.

很多人会告诉你,在SQL Server存储会话状态是一个性能问题,但我不同​​意:失去会话由于工艺回收超过SQL Server的性能的关注。 Besidess ASP.NET状态服务器是更快,如果这就是你真正需要(如果你想生存动力循环,你甚至可以编写一个的NoSQL数据库存储状态的自定义提供!)

A lot of people will tell you that storing session state in SQL Server is a performance problem, but I disagree: losing sessions due to process recycles is more of a concern than the performance of SQL Server. Besidess the ASP.NET state server is faster if that's what you really need (and if you want to survive power cycles you could even write a custom provider that stores state in a NoSQL database!)

这篇关于什么时候一个ASP.NET网站项目重新编译?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆