0
我面臨很奇怪的情況。我正在開發我的ASP.NET
應用程序並在Visual Studio開發服務器上進行調試,當某些組件完成時,我在IIS上發佈我的應用程序以讓其他人測試輸入數據。所以當我在dev上運行它時。服務器,一切都很好,但在IIS上,頁面加載非常慢。asp.net包括javascript慢在iss
所以第一個問題是如何編譯應用程序在調試模式下比應用程序更慢?
我想知道爲什麼,所以我開始從我的site.master.cs
文件中刪除JavaScript。它確實有幫助,但它以意想不到的方式工作。
我包括這段代碼完成:
ClientScriptManager cs =Page.ClientScript;
cs.RegisterClientScriptInclude(typeof(string), "jquery", Page.ResolveClientUrl("~/Scripts/jquery-1.8.0.min.js"));
cs.RegisterClientScriptInclude(typeof(string), "jqueryUI", Page.ResolveClientUrl("~/Scripts/jquery-ui-1.8.23.custom.min.js"));
cs.RegisterClientScriptInclude(typeof(string), "utility", Page.ResolveClientUrl("~/Scripts/utility.js"));
cs.RegisterClientScriptInclude(typeof(string), "forms_v2", Page.ResolveClientUrl("~/Scripts/forms_v2.js"));
cs.RegisterClientScriptInclude(typeof(string), "odkazy", Page.ResolveClientUrl("~/Scripts/odkazy.js"));
cs.RegisterClientScriptInclude(typeof(string), "tabs_v2", Page.ResolveClientUrl("~/Scripts/tabs_v2.js")); //Nahradí tabs
cs.RegisterClientScriptInclude(typeof(string), "user", Page.ResolveClientUrl("~/Scripts/user.js"));
cs.RegisterClientScriptInclude(typeof(string), "grafika", Page.ResolveClientUrl("~/Scripts/grafika.js"));
cs.RegisterClientScriptInclude(typeof(string), "json2", Page.ResolveClientUrl("~/Scripts/json2.js"));//IE7
所以通過去除包括一個接一個,我發現,這個問題是由forms_v2.js
只引起的,但我不能簡單地刪除這個劇本,我需要找出究竟哪個功能減慢了我的應用程序。但在刪除腳本中的全部文本後,沒有任何更改。
所以最後情況是這樣的:當包含forms_v2.js
即使它是空文件時,我的應用程序非常慢,但是當這個包含被刪除時,一切正常。
P.S.我知道爲了提高性能,最好少用JS文件,我會在部署之前將它合併並縮小,所以這不是我的問題。
是啊,我覺得幫助,感謝前要檢查現有的這些腳本。但我不知道爲什麼,你能解釋一下,它是如何工作的?我認爲服務器在已經註冊時更新腳本。 – david
嗯,我不確定,但我認爲它只是放在另一個不相同的腳本塊。 – Vytalyi