.Net MVC3 app

系统教程 行业动态 更新时间:2024-06-14 16:55:57
.Net MVC3 app_offline.htm与css / images有关(.Net MVC3 app_offline.htm issues with css/images)

我想使用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).

更多推荐

本文发布于:2023-04-10 11:23:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/72f50a01db15115d5cdf06703e22217a.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Net   app

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!