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

前端之家收集整理的这篇文章主要介绍了asp.net – app_offline.htm在生产框中抛出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

原文链接:https://www.f2er.com/aspnet/250324.html

猜你在找的asp.Net相关文章