如何减少在 IIS 5.1 中开发 ASP.NET Web 应用程序时对 IISRESET 的需求

发布于 2024-08-22 02:44:26 字数 742 浏览 10 评论 0原文

我的开发 PC 上有一个运行 WinXP 的 Web 应用程序项目,因此运行 IIS 5.1。我对此站点所做的更改似乎只有在执行 IISRESET 后才会“生效”。也就是说,我进行源更改,重新生成项目,然后在不调试(或带调试)的情况下启动。除非我使用 IISRESET 进行干预,否则新更改的代码不会“可见”或生效。

顺便说一句,Web 应用程序项目的属性显示上的“web”选项卡配置为使用项目 Url 处的本地 IIS Web 服务器: http ://localhost/myVirtualDirectory

...

但是我在使用 VStudio Dev Server 时注意到了同样的问题(即我必须通过访问任务栏托盘区域来停止它才能看到我的源更改生效) 。

这是我可以改变的吗?

编辑更新:

如果可能的话,只是想清除它。下面有两个不同的答案;不知道如何前进。有人说这是可以预料到的(IIS 5.1 的弱点,而 IIS 5.1 又是 WinXP 所能提供的最好的)。另一种说法是这不是预期的行为(我倾向于同意,因为这是我第一次在我已经使用了很长时间的旧 WinXP 开发平台上遇到这种情况)。我怀疑这可能是 Visual Studio 2008 Web 应用程序“深处”的东西,该应用程序已从 VStudio 2002 (ASP.NET 1.1) 升级到这个新的 IDE。我尝试在每个答案路径中添加评论/问题。谢谢。

I have a web application project on my dev PC running WinXP and hence IIS 5.1. The changes I'm making to this site seem to "take effect" only after I do IISRESET. That is, I make a source change, Rebuild the project and then Start without Debugging (or with debugging). The newly changed code is not "visible" or in effect unless I intervene with an IISRESET.

BTW, the "web" tab on the Properties display for the web app project is configured to use the Local IIS web server at project Url: http://localhost/myVirtualDirectory

...

but I've noticed the same issue when using the VStudio Dev Server (i.e. I have to stop it by visiting the taskbar tray area in order to see my source changes take effect).

Is this something I can change?

EDIT UPDATE:

Just wanting to clear this up if possible. Two answers diverge below; not sure how to move forward. One states this is to be expected (weakness of IIS 5.1 which in turn is the best WinXP can provide). Another states this is not expected behavior (and I tend to agree since this is the first I've encounted this on the same old WinXP dev platform I've had a long time). I suspect it may be something "deep inside" the Visual Studio 2008 web app which was upgraded to this new IDE from VStudio 2002 (ASP.NET 1.1). I've tried to add comment/questions down each answer path. Thanks.

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

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

发布评论

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

评论(7

你好,陌生人 2024-08-29 02:44:26

这根本不是正常行为。 ASP.NET 应该自动重新加载您放入 bin 目录中的所有程序集。如果您使用动态编译,它也应该在代码隐藏文件中获取新代码。

第一,确保您使用正确的 CodeFile 或 CodeBehind 指令。 CodeFile用于动态编译。

如果您有一个 Web 应用程序项目并将 .cs 源文件编译为 DLL,请确保您的项目将 DLL 放入正确的目录...即 /[ApplicationRoot]/bin。

This is not normal behavior at all. ASP.NET should automatically reload any assemblies you put in your bin directory. If you are using dynamic compilation, it should pick up new code in codebehind files as well.

One, make sure you are using the correct CodeFile or CodeBehind directive. CodeFile is for dynamic compilation.

If you've got a Web Application Project and compiling your .cs source files into a DLL, then make sure your project is dropping the DLL into the correct directory... which is /[ApplicationRoot]/bin.

葬﹪忆之殇 2024-08-29 02:44:26

这不会改变它,但您可以将 IISReset 作为构建后脚本的一部分。

This won't change it but you could make the IISReset part of your post-build script.

东北女汉子 2024-08-29 02:44:26

我不得不说这不是标准行为。我已经在VS2005中开发了一段时间了,一直在使用XP、2003及更高版本的系统。但即使在 XP 上我也从未发生过这种情况。

去年,我的两个同事仍在使用 XP 来开发我们一直在使用的 Web 应用程序。我们正在开发完全相同的代码库,在 SVN 存储库中共享。其中一个同事也遇到了同样的问题你在这里,我们找不到解决方案,我们就保持原样。另一个同事的机器工作得非常好(都在相同的硬件上)

这是一个悲伤的故事,因为最后他的 IIS 变得如此搞砸了,他被迫使用 VS Web 服务器几个月,直到系统管理员同意在他的盒子里重新安装 Windows :)

这个故事的士气?我认为你的 Windows / IIS 安装搞砸了...尝试从 MS 获取最新更新,如果没有其他帮助 - 我建议进行全新安装..抱歉,但希望这会有所帮助...

I do have to say that it's not the standard behaviour. I have been developing in VS2005 for awhile now, and I have been using XP, 2003 and later systems. But even on XP I've never had that happen.

Last year, two of my co-workers were still using XP to develop the web app we've been working in.. And we were working on the EXACT same codebase, shared in an SVN repository.. One of them had the same issue you have here, and we couldn't find a solution, and we just left it as it was.. The other coworker's machine was working absolutely fine (both on identical hardware)

It's a sad story, because in the end his IIS became so messed up that he was forced to use the VS web server instead for a couple of months until the sysadmin agreed to reinstall Windows in his box :)

The morale of the story? I think your Windows / IIS installation is messed up... Try to get the latest updates from MS, and if nothing else helps - I'd recommend doing a clean install.. Sorry, but hope this helps...

入画浅相思 2024-08-29 02:44:26

您可能需要检查位于此处的注册表项:

HKLM\Software\Microsoft\ASP.NET\FCNMode

如果您看到此注册表项,请确保将其设置为 0 或大于 2。如果将其设置为 1,则在构建时 ASP.NET 将不会收到文件更改通知将会经历您所描述的确切症状。每当您构建 Web 应用程序解决方案时,应用程序都应该重新启动。如果这没有发生,这可能就是答案。

You may want to check the registry key located here:

HKLM\Software\Microsoft\ASP.NET\FCNMode

If you see this registry key, be sure it's set to 0 or greater than 2. If it's set to 1, ASP.NET will not receive a file change notification when you build and you will experience the exact symptoms you're describing. Whenever you build your web application solution the app should restart. If that's not happening, this may be the answer.

故事未完 2024-08-29 02:44:26

相同的症状以及永久内存使用量增长曾经向我表明,由于错误的单例使用,某些控件没有被清理。我建议对您的应用程序进行一些内存分析。

Same symptoms together with permanent memory usage growth showed me once that some controls where not cleaned up because of wrong singleton usage. I'd propose to do some memory profiling of your application.

自由如风 2024-08-29 02:44:26

我过去也经历过类似的问题。 web.config 中的任何更改始终会触发应用程序正确重新加载。

只需在末尾插入一个空字符串并保存它,网络应用程序就会在下一个页面加载时重新加载。出于我的目的,我创建了一个脚本,在每次构建后执行此操作。听起来很简单,但总是有效。

I've experienced similar issues in the past. What will always trigger the application to be properly reloaded is ANY change in the web.config.

Just insert an empty string at the end and save it and the web app will be reloaded at the next page load. For my purposes I've created a script that does it after every build. It sounds simple but it always works.

﹉夏雨初晴づ 2024-08-29 02:44:26

遇到了同样的问题并设法找到了一个奇怪的答案。

问题:当源代码被编辑并且 IIS 不想更新编辑时。

在项目设置中,Web 我将服务器更改为使用 Visual Studio 开发服务器而不是使用 IIS Web 服务器。

然后用 F5 运行 VS Development Server,这样我就可以看到源代码编辑后的变化。我离开了设置,但随后使用 IIS 服务器访问了我的主页。现在,这些变化正在按其应有的方式更新。

因此,当忽略 IIS 并告诉它不要在项目设置中使用时。 IIS 正在获取新的源代码并显示更改。

Had the same problem and managed to find a wierd answer.

Problem: When the source-code is edited and IIS does not want to update the edit.

In Project Settings, Web I changed the Servers to Use Visual Studio Development Server instead of Use IIS Web server.

Then ran VS Development Server with F5 so I can see the change after SourceCode edit. I left the Setting, but then went to my homepage using IIS server instead. Now the changes are updating like it should.

So, when leaving out IIS and telling it NOT to be used in Project Settings. IIS is fetching the new source code and displaying the changes.

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