VS2008 Website Application Project, Long Wait to see page after build
Just started a new Web Site Application project, and just find it takes to long to open my webpage straight I build it. This is a brand new project which has just the minimum number of files, but th开发者_JAVA技巧ere is other files in the folder which are not part of the project which are not included in my project.
Anyway I press build, build complete, try open the webpage i.e. http://unitedcms/default.aspx.
Need to wait like 1 min before it loads, after that initial load it loads instantly ofcourse im just wondering why that initial load takes so long ?
The reason for this is that IIS/Cassini compiles your project after every build. This compilation takes time to complete. Once compiled, IIS/Cassini stores them in cache. On subsequent requests, IIS/Cassini will not recompile the code but serve it from the cache.
That's the reason your first request is always slow.
Here is an example. Using notepad, edit your web.config file (just add an empty line or space). Save it. And then try to open your site again. It will take time to load. That's because IIS checks your web.config file's last modified time stamp and if it's newer than the one in cache, it will re-compile the code.
Hope this helps.
精彩评论