1

任何人都知道为什么 mvc 网站在第一个字节的时间上会如此缓慢。主页没有数据库连接,我刚刚上传了一个 mvc 主页,加载大约需要 15 秒,复制 url 并粘贴到另一个浏览器窗口中,也需要同样长的时间。

但是把 index.html 放在最后,它会瞬间加载。

网址已移除

如果我复制源代码并粘贴到记事本并创建 html 页面,非常快

站点在 Windows IIS 7.5 上运行

在尝试查找问题时,我无法真正上传完整的网站

谢谢乔治

---------首页代码-------------

using DevTrends.MvcDonutCaching;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.SessionState;
using Web.UI.ModelHelpers.Validation;

namespace Web.UI.Controllers
    {
    //[SessionState(SessionStateBehavior.Disabled)]
    public class HomeController : Controller
        {
       // [DonutOutputCache(CacheProfile = "Cache1Hour")]
        public ActionResult Index()
            {
            ViewBag.Title = "Active Tourist Search Engine";
            return View();
            }

        public PartialViewResult pvSearchForm(string Option, string Page)
            {
            if (string.IsNullOrEmpty(Option) || string.IsNullOrEmpty(Page))
                {
                var model = new SearchEngineValidation
                {
                    Option = "Web",
                    Page = "1",
                    ISB = "1",
                };
                ViewBag.SearchButtonText = "Web";
                return PartialView("~/Views/Shared/pvSearchForm.cshtml", model);
                }
            else
                {
                var model = new SearchEngineValidation
                {
                    Option = Request.QueryString["Option"],
                    Page = Request.QueryString["Page"],
                    ISB = "0",
                };
                ViewBag.SearchButtonText = model.Option;
                return PartialView("~/Views/Shared/pvSearchForm.cshtml", model);
                }
            }
        }
    }

你会注意到我已经注释掉了缓存,缓存加载速度很快,但我试图找到潜在的问题

提琴手的输出

Request Count:   1
Bytes Sent:      323        (headers:323; body:0)
Bytes Received:  6,325      (headers:270; body:6,055)

ACTUAL PERFORMANCE
--------------
ClientConnected:    13:30:39.611
ClientBeginRequest: 13:30:39.611
GotRequestHeaders:  13:30:39.611
ClientDoneRequest:  13:30:39.611
Determine Gateway:  0ms
DNS Lookup:         1ms
TCP/IP Connect: 38ms
HTTPS Handshake:    0ms
ServerConnected:    13:30:39.651
FiddlerBeginRequest:    13:30:39.651
ServerGotRequest:   13:30:39.652
ServerBeginResponse:    13:30:54.102
GotResponseHeaders: 13:30:54.102
ServerDoneResponse: 13:30:54.102
ClientBeginResponse:    13:30:54.154
ClientDoneResponse: 13:30:54.154

    Overall Elapsed:    00:00:14.5428318
4

0 回答 0