app_offline.htm扔HTTP生产箱500错误 [英] app_offline.htm throwing HTTP 500 errors on production box

查看:256
本文介绍了app_offline.htm扔HTTP生产箱500错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个 app_offline.htm 有关IIS7 /的Win2008 64位运行ASP.NET MVC2应用程序文件,并确保它是超过512字节(这是2KB现在)。在运行Visual Studio 2010中我开发框,它的工作原理就像一个魅力,但是当我把它的生产中,我得到的是通用的HTTP 500错误提示无法显示该页面,因为发生内部服务器错误。

什么是特别奇怪的是,我没有得到任何东西记录在应用程序事件日志,也不ELMAH挑不出什么了。我已禁用自定义错误,把FormsAuthentication位置异常的文件,确保我没有引用任何其他文件(图片等),但没有修复它。

我读过关于SO和谷歌搜索每一个岗位几个小时,不明白这一点。任何想法可能是错误的?我拉我的头发在这里...


解决方案

更新:结果
你在你的web.config有这个?

 <?XML版本=1.0编码=UTF-8&GT?;
<结构>
    <&的System.Web GT;
        <的httpRuntime waitChangeNotification =300maxWaitChangeNotification =300/>
    < /system.web>
    < system.webServer>
        <模块runAllManagedModulesForAllRequests =真/>
    < /system.webServer>
< /结构>


  

但还有一抓。


  
  

ASP.NET将卸载应用程序
  一旦web.config中被改变,但
  它实际上并不会重新加载和应用
  在waitChange ...设置,直到
  请求。所以,你仍然可以
  放下app_offline.htm和
  WEB.CONFIG中,并且如果第一requst
  当出现一个dll只有一半
  复制,将出现异常。至
  雪上加霜的是,异常
  坚持不懈,直到您更换
  临时的web.config或总
  你的waitChange ......持续时间
  过期!


  
  

要解决这个最后一关,你会
  需要对所述请求
  上传应用程序后,
  暂时的web.config文件,但在此之前你
  开始部署应用程序文件。
  完整的过程如下:


  
  

      
  1. 添加app_offline.htm

  2.   
  3. 用临时的web.config替换应用程序的web.config(如上)

  4.   
  5. 请求网站上的任何ASP.NET资源,因此新
      waitChangeNotification被加*

  6.   
  7. 请任何文件系统需要改变(部署斌dll文件,其他网站
      文件)

  8.   
  9. 替换临时的web.config与原有应用程序
      web.config中

  10.   
  11. 删除app_offline.htm

  12.   

  
  

*您可以争步骤2-3发生了什么,因为ASP.NET关闭
  步骤1后的确申请,
  不从我的事件查看器出现
  该web.config中的变化是
  注册或应用作为结果
  任一步骤2或3,但尽管如此
  更新waitChangeNotification
  第3步之后就得到应用设置。


更多app_offline.htm困境

App_offline.htm与ASP.NET MVC

I have created an app_offline.htm file for an ASP.NET MVC2 application running on IIS7 / Win2008 64-bit, and ensured that it's over 512 bytes (it's 2KB right now). On my dev box running Visual Studio 2010, it works like a charm, but when I put it on the production box, all I get is the generic HTTP 500 error saying "The page cannot be displayed because an internal server error has occurred."

What's especially strange is that I don't get anything logged in the application event log, nor does ELMAH pick anything up. I've disabled custom errors, put FormsAuthentication location exceptions for the file, ensured I'm not referencing any other files (images, etc.), but nothing fixes it.

I've read every post on SO and Googled for hours and can't figure this out. Any ideas what might be wrong? I'm pulling my hair out here...

解决方案

UPDATE:
Do you have this in your web.config?

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.web>
        <httpRuntime waitChangeNotification="300" maxWaitChangeNotification="300"/>
    </system.web>
    <system.webServer>
        <modules runAllManagedModulesForAllRequests="true" />
    </system.webServer>
</configuration>

But there’s one more catch.

ASP.NET will unload the application as soon as the web.config is changed, but it won’t actually reload it and apply the "waitChange…" settings until a request is made. So you could still drop the app_offline.htm and web.config in, and if the first requst occurs while a dll is only half copied, the exception will occur. To add insult to injury, the exception will persist until you replace the temporary web.config or the total duration of your "waitChange…" time expires!

To get around this final hurdle, you’d need to make a request to the application after uploading the temporary web.config, but before you start deploying the application files. The complete process is as follows:

  1. Add app_offline.htm
  2. Replace application’s web.config with a temporary web.config (as above)
  3. Request any ASP.NET resource on the site so the new waitChangeNotification gets "applied"*
  4. Make any file system changes necessary (deploy bin dlls, other site files)
  5. Replace temporary web.config with the original application web.config
  6. Delete app_offline.htm

*You may dispute what happens in step 2-3, since ASP.NET shuts down the application after step 1. Indeed, it does not appear from my event viewer that the web.config change is registered or "applied" as a result of either step 2 or 3, but nevertheless the updated waitChangeNotification settings do get applied after step 3.

More app_offline.htm woes

App_offline.htm gotchas with ASP.NET MVC

这篇关于app_offline.htm扔HTTP生产箱500错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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