App_offline.htm、CSS、图像和 aspnet_isapi.dll
因此,我正在开发的网站正在使用 urlrewriting 与 aspnet_isapi.dll 配合(所有内容都映射到它)。我放置了 app_offline.htm 文件,所有文本均显示,但是 CSS 或图像未提供服务。我猜测由于通配符映射而不是 IIS,它们正在由 ASP.NET 处理。这是正确的吗?如果是这样,我怎样才能允许 IIS 提供这些文件?此外,我可以在重写器设置的 web.config 中看到出现的问题:
<rewrite url="^~/images/network/(.*)/(.*).jpg$" to="~/services/ImageHandler.ashx?type=$1&id=$2"/>
<rewrite url="^~/image/view/(.*).jpg$" to="~/ServePRView.aspx?id=$1"/>
<rewrite url="^~/asset/view/(.*).jpg$" to="~/services/ImageHandler.ashx?id=$1&type=asset"/>
感谢大家的帮助, -史蒂夫
So, the site I'm working on is using urlrewriting in coordination with aspnet_isapi.dll (everything is mapped to it). I put up my app_offline.htm file, and all the text shows, however, the CSS or images aren't being served. I'm guessing they're being processed by ASP.NET due to the wildcard mapping instead of IIS. Is this correct? If so, how can I allow IIS to serve these files? Furthermore, an issue I can see arising..in the web.config for the rewriter settings:
<rewrite url="^~/images/network/(.*)/(.*).jpg$" to="~/services/ImageHandler.ashx?type=$1&id=$2"/>
<rewrite url="^~/image/view/(.*).jpg$" to="~/ServePRView.aspx?id=$1"/>
<rewrite url="^~/asset/view/(.*).jpg$" to="~/services/ImageHandler.ashx?id=$1&type=asset"/>
Thanks for the help all,
-Steve
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是因为,如果网络服务器看到 App_Offline.htm 文件,它就会为站点中的每个请求(甚至图像)提供该文件。您必须提供来自另一个站点的图像。或者你可以尝试这样的http://en.wikipedia.org/wiki/Data_URI_scheme
It's because if the webserver sees an App_Offline.htm file, it serves that file for every request in the site - even images. You have to serve images from another site. Or you can try something like this http://en.wikipedia.org/wiki/Data_URI_scheme
@JeremyWeir 是正确的。 IIS 在存在 app_offline.htm 的情况下停止提供子资源 解决此问题的方法是使用以下方法直接将内容嵌入到页面中:
1) 在 Html 中对图像进行编码
2) 内部样式表
3) 对于您的 javascript 来说也是如此
这不是最容易维护的,但它确实可以让您控制页面上显示的内容的外观。
@JeremyWeir is correct. IIS stops serving sub resources in the prescense of app_offline.htm A way around this is to embed the content in the page directly by using:
1) Encode Images inside Html
2) Internal Style Sheets
3) the same for your javascript
This isn't the easiest to maintain but it does give you control over the appearance of the content displayed on the page.