调用aspx页面返回的图像随机慢 [英] call aspx page to return an image randomly slow

查看:140
本文介绍了调用aspx页面返回的图像随机慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OK,这里是一个问题,我有一个asp.net网站,有一个aspx页面称为GetThumbnail.aspx中,code是象下面这样:

OK, here is the question, I have a asp.net website, there is an aspx page called GetThumbnail.aspx, the code is like below:

string newThumbnailPath = ReaderUtilities.GetThumbnailPath(ptiId, highQuality ? ZoomLevel.L : ZoomLevel.S);
Response.Clear();
if (File.Exists(newThumbnailPath))
{
  Response.ContentType = "image/jpg";
  Response.TransmitFile(newThumbnailPath);
}

这是它。新的 newThumbnailPath 是网络共享路径,平时喜欢D:\\ ImagesCache \\ 000 \\ 0001 \\ 000123 \\ 000123456 \\ 000123456-SML-1.JPG

That is it. the new newThumbnailPath is a network share path, usually like D:\ImagesCache\000\0001\000123\000123456\000123456-sml-1.jpg

然后在我的网站上有一个searchResult.aspx,当用户键入某些关键词进行搜索,我将显示searchresult.aspx页面上,searchResult.aspx里面,我将显示10张图像时,code低于

Then in my website there is a searchResult.aspx, when user type some keyword to search, I will display the searchresult.aspx page, inside the searchResult.aspx, I will display 10 images, the code is below:

<img rel="429746" src="/GetThumbnail.aspx?p=429746" class="cover-img draggable">

OK,问题是,每次,生产服务器上,必须有几个图像加载速度很慢,说8个图像平均1秒内加载,但2图像需要7或9秒加载。所有的图像都小,他们并不需要调整,我用萤火虫网检查,慢加载图像DNS查找,连接和发送都几乎为1ms,和接收是200或300毫秒,但需要等待8或9秒。

OK, the question is, everytime, on production server, there must be several images loading very slow, say 8 images load within averagely 1 second, but 2 images take 7 or 9 seconds to load. All the images are small, and they don't need to resize, I used firebug Net to check, the slow loading images' DNS lookup, Connecting and Sending are all almost 1ms, and Receiving is 200 or 300ms, but the Waiting takes 8 or 9 seconds.

我认为这是因为IO的,但为什么大多数图像的很快,只是一些随机,任何帮助。我真的AP preciate它。

I thought it is because of IO, but why most of images are quick, just some and randomly, any help. I really appreciate it.

推荐答案

由于您使用的.aspx 页(而不是处理器),同时,由于加载到浏览器不是一个接一个,但许多图像一起的我怀疑你觉得在页面会话锁,这就是为什么这种延迟。

Because you use .aspx page (and not handler), and because the images loaded by browser not one by one, but many together, I suspect that you felt on the session lock of the page and that's why this delay.

尝试设置 =的EnableSessionState假在页面上。

例如:

<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" 
    AutoEventWireup="false" Inherits="WebApplication1.WebForm1" 
     EnableSessionState="false" %>

顺便说一句,如果你改变aspx页面给你去获得一些更多的速度,因为处理程序页面并没有让所有的调用,通常一个网页做处理页面。

By the way, if you change the aspx page to a handler page you going to gain some more speed because the handler page did not make all the calls that a normally page do.

这篇关于调用aspx页面返回的图像随机慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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