0

任何人都知道这个错误,该错误仅在使用 ASP.Net 语言处理图像并在 IIS7 上发布项目时发生。如果你知道,请帮助我。非常感谢!

例如:在 IIS7 上发布后在屏幕上抛出异常但我无法阅读它 => “Y�o�6����S�X~�m;F�]���I���\ 4��ȤJR~4���!%�rl'��zk �Hq�y�Qi}�����\wahFq����+Я5D��nl��}�1*~�G ���ʻaa7�F*�p3��7{ �R��E$�!���b&LC �# !08�11}�Ec������"9ѧ{\��4��� #�TȐ��I:�A'�H�00��La���)d�0B�"pY�G�����8�5J ��$J�B�\Ew�(�&xRm� �vt����W�{�X�תd�-�z��9.Jc��D*S�<����"�1��%�ŵ����/�N� �m�ӗq�3�e����%&W��ZV�y��$��+�����2f�tP�> x�����[)�NX�E�� g�hT�U9�F�;�$�`y��e�(*�H�U�<7\�!��0��r����R4@H��

=> 这是什么错误?

(我不能发布图片,因为没有足够的 10 声望)

它使用 IIS7 在 localhost 上工作,但在服务器 IIS7 上它已经死了。这是我调整图像大小的功能:

public static string CustomCropAdvertising(string imageName, int width, int height) {
        var inputPath = HttpContext.Current.Server.MapPath("~/Images/rao-vat/img_raovat/" + imageName);
        var outputPath = HttpContext.Current.Server.MapPath("~/Images/rao-vat/temp_image/" + imageName);
        Image image = Image.FromFile(inputPath);
        Bitmap bmp = new Bitmap(width, height, PixelFormat.Format24bppRgb);
        bmp.SetResolution(300, 300);

        var radio = (double)height/image.Height;
        var x = 0.0;
        var y = 0.0;
        var scale = image.Height < height;
        Graphics gfx = Graphics.FromImage(bmp);
        gfx.SmoothingMode = SmoothingMode.AntiAlias;
        gfx.InterpolationMode = InterpolationMode.HighQualityBicubic;
        gfx.PixelOffsetMode = PixelOffsetMode.HighQuality;
        gfx.Clear(Color.White);

        if (scale) {
            x = Math.Floor((double)((width - image.Width) / 2));
            y = Math.Floor((double)((height - image.Height) / 2));
            gfx.DrawImage(image, (int)x, (int)y, image.Width, image.Height);
        } else {
            var cropedWidth = image.Width * radio;
            var cropedHeight = image.Height * radio;
            if (width > image.Width) {
                x = Math.Floor((double)((width - cropedWidth) / 2));
                gfx.DrawImage(image, (int)x, 0, (int)cropedWidth, (int)cropedHeight);
            } else {
                x = Math.Floor((double)((image.Width - width) / 2));
                y = Math.Floor((double)((image.Height - height) / 2));
                gfx.DrawImage(image, new Rectangle(0, 0, width, height), (int)x, (int)y, width, (int)cropedHeight, GraphicsUnit.Pixel);

            }
        }


            bmp.Save(outputPath, ImageFormat.Jpeg);

        gfx.Dispose();
        bmp.Dispose();
        return "/Images/rao-vat/temp_image/" + imageName;
    }

哦,我必须使用 Telerik Control 来支持 Ajax !:)

“Firebug bar”的“控制台”选项卡上显示的错误是“500 Internal Server Error”,并且标签仅包含上述文本。

4

0 回答 0