加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net – app_offline.htm在生产框中抛出HTTP 500错误

发布时间:2020-12-15 23:24:38 所属栏目:asp.Net 来源:网络整理
导读:我为IIS7 / Win2008 64位运行的ASP.NET MVC2应用程序创建了一个app_offline.htm文件,并确保它超过512个字节(现在是2KB).在我的运行Visual Studio 2010的开发框中,它的作用就像一个魅力,但是当我把它放在制作盒上时,我所得到的就是通用的HTTP 500错误,“出现
我为IIS7 / Win2008 64位运行的ASP.NET MVC2应用程序创建了一个app_offline.htm文件,并确保它超过512个字节(现在是2KB).在我的运行Visual Studio 2010的开发框中,它的作用就像一个魅力,但是当我把它放在制作盒上时,我所得到的就是通用的HTTP 500错误,“出现内部服务器错误,无法显示该页面”.

特别奇怪的是,我没有记录任何应用程序事件日志,ELMAH也没有选择任何东西.我已经禁用了自定义错误,为文件放置FormsAuthentication位置异常,确保我没有引用任何其他文件(图像等),但没有修复它.

我已经阅读了SO和Google Googled上的每个帖子几个小时,不能弄清楚.任何想法可能是错的?我在这里拉我的头发

解决方法

更新:
你有这个在你的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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读