我是否应该在部署之前预编译 ASP.NET 2.0 站点?

发布于 2024-07-24 16:19:33 字数 343 浏览 4 评论 0原文

在我工作的地方,我们制作了大量非常小的 ASP.NET 应用程序,并且已经发生过几次网站以预编译格式部署的情况,并且需要更改应用程序,但是源代码中可用的代码版本控件已过时且开发人员不可用。 该应用程序的 dll 必须被反编译并重新组合在一起。

理想情况下,开发人员永远不会通过测试和生产匆忙进行更改并跳过检查更改,此后我们对策略进行了更改以防止这种情况发生,但我想知道在服务器上编译站点的开销是否会增加每当应用程序池重新启动时都是一个足够大的问题,我们应该避免将代码直接上传到服务器。 如果我们可以下载实时源代码,那么检查源代码管理中的版本与实际实时版本会更容易。

预编译VS直接上传cs文件到服务器并在那里编译有什么好处?

Where I work, we do a very large number very small ASP.NET apps, and it has happened a few times that sites have been deployed in precompiled format, and the app needs to be changed, but the version of the code available in source control is out of date and the developer is not available. The app's dll has to be decompiled and hacked back together.

Ideally, it would never happen that a develpoer rushes a change through testing and production and skips checking in the change, we have since made changes to our policies to keep this from happening, but I wonder if the overhead of compiling a site on the server whenever the app pool restarts is a big enough problem that we should avoid uploading our code directly to the server. It would be easier to check the version in source control vs the actual live version if we could download the live source.

What are the advantages of precompiling VS uploading cs files directly to the server and having them compiled there?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

西瓜 2024-07-31 16:19:33

我不同意针对这一点给出的大多数答案。 与临时发布文件相比,预编译有很多优点,其中最重要的是生产和测试环境中的代码或多或少保持同步。 预编译可以确保您测试的代码每次都是要投入生产的代码。

您遇到的问题不是预编译与首次运行编译之间的问题。 相反,它源于您正在使用的源代码管理类型。 如果我必须猜测(我确实这么做了),我会说您正在运行 Visual SourceSafe。 如果您要切换到使分支和合并变得微不足道的源代码控制系统,那么您可以将代码分为稳定开发分支。 错误修复针对 dev 分支进行(经过验证后,这些分支会合并回 stable 分支)。 这样,未经测试或未准备就绪的代码不会最终出现在生产服务器上,并且您始终拥有可以使用的稳定集的副本。

I disagree with most of the answers given to this point. There are many advantages to precompiling over ad-hoc posting of files, not the least of which is that the code in the production and testing environments stay more or less in sync. Pre-compiling makes it certain that the code you tested is the code going to production every time.

The issue you are running into is not one of pre-compile versus first-run compile. Instead it stems from the type of source control you are using. If I had to guess (and I do), I would say you are running Visual SourceSafe. If you were to switch to a source control system that made branching and merging trivial then you could separate your code into stable and development branches. Bug fixes happen against the dev branches (which then get merged back to the stable branch once validated). That way, untested or otherwise not-ready-for-prime-time code does not end up on the production server and you always have a copy of the stable set to work from.

Oo萌小芽oO 2024-07-31 16:19:33

纯粹从易用性的角度来看,我确实喜欢简单地将源文件上传到服务器,而忘记预编译。

这就是我为我管理的所有网站所做的事情,甚至是大型网站。 我确实尝试养成点击应用程序中更重要部分的习惯,以确保一切正常(并在我使用它们时编译它们)。

这是另一个想法。 如果该网站是公开的,您可以使用w3c 链接检查器对其进行控制。 这将产生编译它所访问的每个页面的效果。 无论如何,确保您没有任何损坏的链接是一件好事。

简而言之,我认为这些例行检查几乎可以消除用户首次访问编译缓慢的问题。 无论如何,由于这是一个很好的惯例,所以它对我来说效果很好。

From purely an ease of use standpoint, I do like simply uploading the source files to the server and forget about pre-compiling.

This is what I do for all of the sites I manage, even the big ones. I do try to make a habit of hitting the more important pieces of the application to make sure everything works (and to compile them while I'm at it).

And here's another thought. If the site is public you can let the w3c link checker loose on it. This will have the effect of compiling every page it hits. And it's a nice thing to do anyway to ensure you don't have any broken links.

Simply put, I suppose these routine checks almost eliminate the problem of slow first-visit-compilation from your users. And since it's a good routine to follow anyway, it has worked out well for me.

仅一夜美梦 2024-07-31 16:19:33

我首先想到的是:

  1. 商业秘密问题
  2. 安全问题
  3. 马虎的 Joe Moe(懒惰、粗心和可怜的想成为开发人员)
  4. 临时黑客攻击失控的代码。

    • 预编译代码以托管格式在 .Net Framework 上安全高效地运行。
    • 未编译代码是由新手部署的,他们没有花时间考虑与不安全代码相关的许多问题,这些问题对最终用户来说运行效率较低。

最终用户利益相关者,并且是开发人员信托责任的对象。 开发人员应该利用一切机会来提高其产品的效率。

免责声明:这些评论是“按原样”表述的,我不在乎你是否对我进行拼写检查。

您真诚的,

DrFunkie

拼写错误,但是非常好的开发人员。
:)

The first thing that comes to mind is:

  1. Trade Secrets Issues
  2. Security Issues
  3. Sloppy Joe Moe the (Lazy, Careless and Pitiful wanna be developer)
  4. Ad Hoc Hacking the Code that's out of control.

    • PreCompiled Code securely and efficiently runs on the .Net Framework in a managed format.
    • UnCompiled Code is deployed by rookies that didn't take the time to consider the many issues associated with unsecure code running way less efficiently for the end user.

End Users are Stake Holders and are the object of a developer's Fiduciary Responsibilities. Developers should take advantage of ever opportunity to improved the efficiently of their products.

DISCLAIMER: These comments are stated "as is" and I don't give a damn if you spell check me.

Sincerely,

DrFunkie

Bad Speller, but damn good developer.
:)

萌化 2024-07-31 16:19:33

这取决于应用程序的大小和使用频率。 如果它的使用频率足够高,以至于应用程序池仅在一天结束时回收,那么在早上首次启动时短暂等待可能是值得的。 如果它每 30 分钟才被命中一次,每次都强制重新编译,那么可能值得预编译。

当然,如果它是一个非常大的应用程序,第一次运行时需要一段时间才能编译,我会倾向于预编译,特别是如果它没有得到持续使用的话。

It would depend on the size of the applications and the frequency of use. If it's being used regularly enough that the app pool is only recycled at the end of the day, a brief wait on first launch in the morning may be worthwhile. If it's only getting hit once every 30 minutes, forcing a recompile each time, it may be worth precompiling.

Of course, if it's a very large app that takes a while to compile on first run, I'd lean towards precompiling, especially if it's not getting constant use.

友谊不毕业 2024-07-31 16:19:33

主要优点是在网络服务器上的编译性能。 它还可以保护您的代码,因为从汇编中读取代码更困难:-)

The main advantage is in compiling performance on webserver. Also it protects your code, because it is harder to read the code from assembly :-)

纵情客 2024-07-31 16:19:33

我上传文件时没有预编译:
这样,由于我的代码有很多错误,我可以直接从服务器使用 Notepad++ 更正它

此外,Visual Web Developer 2008(免费的)没有编译选项:-P

I upload files without precompiling:
in this way, since my code is very buggy, i can correct it with Notepad++ directly from the server

Also, Visual Web Developer 2008 (the free one) does not have the compiling option :-P

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文