ASP.NET MVC:在错误页面奇怪的字符 [英] ASP.NET MVC: Weird characters in error page

查看:170
本文介绍了ASP.NET MVC:在错误页面奇怪的字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于我上传了ASP.NET MVC 1应用的更新版本到服务器,死亡的黄屏已更改为这样的事情:

Since I uploaded an updated version of an ASP.NET MVC 1 application to the server, the Yellow Screen of Death has changed to something like this:

<$c$c>I %&/m {J J t $ؐ@ iG#) * eVe]f@ 흼 { { ; N' ?\\fdl J ɞ! ?~|?\" Ey ')= y6 h ͼhR L w | 2= Ez< 7 :5 < +oy<$c$c> : TWV&LT; [〜2G2ʋyhYՋŤ _N M l { , Xn Q } *g 7 〜 j'u> K {的IW4>的Uw | = -fYzR -

��I�%&/m�{J�J��t��$ؐ@�����iG#)�*��eVe]f@�흼��{���{��;�N'���?\fdl��J�ɞ!���?~|?"��Ey�')=��y6����h���ͼhR��L�w�|��2=��Ez<����7�:5�<�+oy��:� �T����W�v�<[��~2�g�2��?�ʋ�y�hYՋ������t� _N���M�l�����{�,��Xn���Q�}�����*g�������7�� ~��j'u>K�{�IW4�>�U�w�|=-fYzR-���

当直接通过远程桌面访问服务器上有错误页面(在Windows Server 2008 R2,IE8),IE浏览器甚至试图下载的响应,但得到的错误(消息框)。

When accessing pages with errors directly on the server via Remote Desktop (Windows Server 2008 R2, IE8), IE even tries to download the response but get's an error (message box).

任何人都遇到过这种过吗?任何想法如何解决这个问题?

Anybody encountered this before? Any idea how to solve this?

我也发现了这个问题,这似乎是很这类似于,但遗憾的是一直没有现在回答:<一href=\"http://stackoverflow.com/questions/2054223/asp-net-mvc-app-displaying-weird-characters\">http://stackoverflow.com/questions/2054223/asp-net-mvc-app-displaying-weird-characters

I also found this question, which seems to be very simliar, but unfortunately has not been answered by now: http://stackoverflow.com/questions/2054223/asp-net-mvc-app-displaying-weird-characters

推荐答案

最有可能你正在展示由gzip编码在code引起的画面。你可能被应用到Response.Filter使用GZIP / DeflateStream类,并打算EN code您的内容,但随后出现错误和ASP.NET清除你的头,但是离开过滤器完好。其结果是,你的内容的GZip EN codeD,但浏览器不会去code,因为内容编码头未设置。

Most likely the screen you're showing is caused by GZip encoding in your code. You probably are applying a Response.Filter to the GZip/DeflateStream class and intending to encode your content, but then an error occurs and ASP.NET clears your Headers, but leaves the filter intact. The result is that your content is GZip encoded but the browser doesn't decode it because the Content-Encoding header isn't set.

要解决这个地址:

Response.Filter = null

到顶部您的Application_Error日常强迫任何Repsonse过滤器就一目了然了。

into your Application_Error routine at the top to force any Repsonse filters to clear out.

这是可以拧您的另一件事是GZip压缩内容的OutputCaching。如果有任何OutputCaching应用确保您有 VaryByCustom是选项,允许不同的编码类型(无,Gzip已,放气,最有可能的)。

Another thing that can screw you up is OutputCaching of GZipped content. If any OutputCaching is applied make sure you have the VaryByCustom option to allow for the different encoding types (none, Gzip, Deflate most likely).

+++里克 -

这篇关于ASP.NET MVC:在错误页面奇怪的字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆