我想使用root app_offline.htm文件作为维护页面。
设计回来了一个需要图像和CSS的维护页面。
我添加了图像并运行了网站,但图像无法渲染。 我看着萤火虫,看到图像显示503错误(服务不可用)。 这是有道理的,因为runAllManagedModulesForAllRequests="true"在web.config中,因此所有请求都将通过.net运行,因此错误。
我以为我能在web.config中做到这一点,但没有运气:
<location path="offline"> <system.webServer> <modules runAllManagedModulesForAllRequests="false"/> </system.webServer> </location>是不是建议用于MVC的app_offline.htm? 还有更好的选择吗?
I'd like to use the root app_offline.htm file as a maintenance page.
Design came back with a maintenance page that will require images and css.
I added the image and ran the site, but the image won't render. I looked in firebug and saw that the image is showing a 503 error (service unavailable). This makes sense seeing as runAllManagedModulesForAllRequests="true" is in the web.config, so all requests will run through .net, hence the error.
I thought I'd be able to do this in the web.config, but no luck:
<location path="offline"> <system.webServer> <modules runAllManagedModulesForAllRequests="false"/> </system.webServer> </location>Is an app_offline.htm not recommended for MVC? Is there a better alternative?
最满意答案
我甚至不知道app_offline.htm为MVC工作:-)
作为替代方案,您可以创建全局过滤器,或者如果您有一个公共控制器基类,则在打开维护标志时,将所有流量重定向到维护视图(标志可以在DB或应用程序配置中)。
I didn't even know app_offline.htm worked for MVC :-)
As an alternative, you could create a global filter or if you have a common controller base class that when the maintenance flag is turned on, redirect all traffic to the maintenance view (flag can be in DB or app config).
更多推荐
发布评论