为什么每次我在 VS 2008 中构建 Web 应用程序时,IIS 开发服务器都会重新编译我的所有 Web 应用程序?

发布于 2024-07-10 15:36:44 字数 628 浏览 7 评论 0原文

我们有一个 Web 应用程序项目(不是网站),直到我们将 batch="false" 添加到 web.config 的那一天,Web 开发服务器正在编译所有 Web 应用程序而不是所请求的页面。

<compilation debug="true" batch="false">
      <assemblies>
        ...
      </assemblies>
</compilation>

这让我们更快。 但我不知道发生了什么变化(我已经从存储库检查了 foo.cproj 和 web.config,比较了旧版本,但发现没有任何东西会导致这种缓慢)。

我查看了 %temp%/Temporary ASP.NET Files; 编译我的 Web 应用程序(不是重新编译,shift + f6)后,我请求一个页面,我看到 Web 服务器从 %temp%/Temporary ASP.NET 文件中删除了所有已编译的文件并重新创建。 我不知道这是否正常,但在我看来,所有网络应用程序都经过了完全重新编译,速度非常慢。 (我通过进程资源管理器查看了 wevdev.wevserver.exe,它多次调用 csc.exe)

如何才能使编译更快? 谢谢...

We have a web application project (not a web site), until the day we have added batch="false" to web.config web development server was compiling all the web application instead of the page that was requested.

<compilation debug="true" batch="false">
      <assemblies>
        ...
      </assemblies>
</compilation>

This make us faster. But I don't know what changed (I have inspected both foo.cproj and web.config from repository, comparing older versions but find nothing can cause this slowness).

I looked at %temp%/Temporary ASP.NET Files; after I compile my web app (not recompile, shift + f6), then I request a page and I see that web server deletes all of already compiled files from %temp%/Temporary ASP.NET Files and recreates. I don't know if this is normal but it seemed to me a full recompilation of all web app, which is very slow. (I looked via process explorer to wevdev.wevserver.exe it calls csc.exe several times)

How can I can make compilation faster? Thanks...

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

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

发布评论

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

评论(2

海的爱人是光 2024-07-17 15:36:44

ASP.NET 开发服务器有一个名为“启用编辑并继续”的选项,可在 32 位版本的 NET CLR 中使用。 在 Visual Studio 中将其关闭。

另外,尝试在“x86”构建中更改“任何 CPU”的构建。 这应该会使编译速度更快。

There is an option for ASP.NET Development Server named 'Enable Edit and Continue' that is available with the 32-bit version of NET CLR. Turn that off in Visual Studio.

Also, try changing the build for 'Any CPU' in a build for 'x86'. That should make compilation faster.

绅刃 2024-07-17 15:36:44

我相信这是使用 Web 应用程序项目的一部分。 每当您构建应用程序时,整个站点都会重新编译。 您应该看到,与“网站”不同,Web 应用程序全部编译为单个 dll(加上引用)。

您必须注意的另一件事是,每当您删除根 Web 应用程序文件夹下的文件/文件夹时,它也会强制重新编译,这对于临时文件来说可能是一个真正的痛苦。

从好的方面来说,一旦完成第一次编译,就不会在未访问的页面上额外等待编译时间。

I believe this is a part of using the Web Application Project. Any time you build your application, the entire site is recompiled. You should see that unlike a 'Web Site', the web application all compiles down to a single dll (plus references).

Another thing you have to watch out for is any time you delete a file/folder under your root web app folder it will also force a recompile, which can be a real pain in the butt for temporary files.

On the plus side once you get over the first compile, there will be no additional waiting for compile times on unvisited pages.

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