I am facing very strange situation. I am developing my ASP.NET application and debugging it on visual studio development server and when I some component is finished, I publish my application on IIS to let other people test the input data. So when I am running it on dev. server, everything is fine, but on IIS the page loading is incredible slow.
So first question is How can be compiled application slower then application in debug mode?
I wanted to find out why, so I started to remove JavaScript includes from my site.master.cs file. And It actually helped, but it works in unexpected way.
My includes are done by this code :
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
So by removing includes one by one I have found out that the problem is caused only by forms_v2.js but I can’t simply remove this script, I need to find out exactly which function slows my app down. But after removing whole text in the script, nothing changes.
So finally the situation is this: when there is include for forms_v2.js even if it’s empty file, my app is very slow, but when this include is removed, everything works fine.
P.S. I know that to improve performance its better to have less JS files and I will merge it and minify before deploying, so that’s not my problem.
Try to check existing of these script before including