IIS无法重新启动,并显示超时错误 [英] IIS fails to restart with a timeout error

查看:191
本文介绍了IIS无法重新启动,并显示超时错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在将新代码发布到生产环境时,我们经常需要更新App_Code目录中的.cs文件.通常,如果生产中有任何用户(并且总是有用户,甚至一夜之间),则在任何应用程序页面加载时都会收到错误消息:

When we're releasing new code to production, we often need to update .cs files in the App_Code directory. Frequently, if there are any users in production (and there are always some, even overnight), we'll get an error message on any application page load:

程序集'C:\ Windows \ Microsoft.NET \ Framework64 \ v2.0.50727 \ Temporary ASP.NET
Files \ root \ a18f28ce \ a6daf424 \ App_Code.dll'已加载到另一个应用程序域中.

The assembly 'C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET
Files\root\a18f28ce\a6daf424\App_Code.dll' is already loaded in another appdomain.

我们发现使应用程序再次响应的唯一方法是重新启动IIS.现在的问题是,IIS将经常无法重新启动.通过进入IIS管理器,单击服务器名称,然后单击右侧的重新启动,我们重新启动IIS.系统将思考几秒钟,然后给出错误消息:

The only way we've found to get the application to respond again is by restarting IIS. Trouble is, now, that IIS will frequently fail to come back up. We restart IIS by going into the IIS manager, clicking on the server name, and then clicking Restart on the right. The system will think for several seconds, and then give the error:

超时错误. W3SVC无法启动.

Timeout error. W3SVC failed to start.

此时唯一的解决方案是重新启动服务器,我们希望在生产服务器上避免这种情况.

The only solution at that point is to restart the server, which we want to avoid on a production server.

关于如何解决IIS超时错误或(理想情况下)如何首先避免已加载到另一个应用程序域中"错误​​的任何想法?

Any ideas on how to troubleshoot the IIS timeout error, or (ideally) how to avoid the "already loaded in another appdomain" error in the first place?

推荐答案

一个简单/自动的解决方案是在部署过程中使用〜/App_Offline.htm文件(IIS内置的一项功能,因此WebDeploy可以避免文件锁定问题).

An easier/automatic solution to the above is to use an ~/App_Offline.htm file as part of your deployment process (a feature baked into IIS so WebDeploy can avoid file locking issues).

修改您的部署过程,以便第一步是在Webroot中创建App_Offline.htm. IIS将检测到该文件并立即关闭应用程序域-释放所有锁定等.正常部署应用程序而没有任何锁定问题,完成后删除App_Offline. IIS收到的下一个请求将启动应用程序域,以加载您新部署的版本.

Modify your deployment process so the first step is to create App_Offline.htm in the webroot. IIS will detect this file and promptly bring down the app domain - releasing any locks etc. Deploy your application as normal without any locking issues, and when your finished, delete the App_Offline. The next request IIS receives will start the app domain loading your newly deployed version.

IIS会为所有请求返回放置在App_Offline.htm文件中的所有内容,直到您删除该文件为止.

Whatever content you place inside the App_Offline.htm file is returned by IIS for all requests until you remove the file.

这篇关于IIS无法重新启动,并显示超时错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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