IIS on localhost is very slow

30,637

Solution 1

Check your web.config file for compilation mode. While you're developing, you should run your site in debug mode. If you're running in release mode, every aspx and ascx will be compiled into temporary assemblies, not only the pages and controls you hit. Also, set batch to false.

<configuration>
    <system.web>
         <compilation debug="true" batch="false" ...>
         ...
         </compilation>
    ...
    </system.web>
    ...

Of course, these are not recommended for production environments, which will be slowed down by these changes.


Also, check this forum thread, where you can find some interesting tips, like resetting the permissions of the ASP.NET temporary files folder:

I had the same problem and made all of the adjustments as mentioned in this forum but it didn't help. I began to suspect that the slow loading time of the dlls had to do with security settings. It appears that access to the dlls goes through security checking that is part of the operating system and not part of VIsual Studio. The dlls are located in a directory for your application under:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\

In order to speed up the security checking, you need to remove all of the security settings on the root folder of your application in the above mentioned directory, or on the directory "Temporary ASP.NET Files" if you want to have it apply to all web applications you develop.

You right mouse click the folder and select Properties -> Security

Remove all users and groups. Some will not be allowed to be removed because they inherit their permissions from their parent folder. You must first remove the inheritance by clicking on the Advanced button and then uncheck the "Inherit from parent..." checkbox. Then remove the user or group. There must not be any users or groups where the checkboxes for their permissions are greyed out. If they are greyed out, it means that you didn't remove the inheritance from their parent.

After you have removed all users and groups from the folder, you then need to add the following users and groups:

Administrators Users ASPNET Network Network Service Local Service

Give each of these accounts full permission. Click on the Advanced button again and check off the "Replace permission entries on all child objects..."

Solution 2

This could be as simple as a DNS issue. Try using 127.0.0.1 instead of localhost when accessing. If this works, then just add a 127.0.0.1 to your hosts file and/or always access via your localhost IP.

Share:
30,637
Nyla Pareska
Author by

Nyla Pareska

Updated on September 17, 2022

Comments

  • Nyla Pareska
    Nyla Pareska over 1 year

    I am using IIS7 on Windows Vista dual core cpu. The first time hit on a WCF service or an ASP.NET webform sometimes takes way longer than a minute which is not really acceptable for me.

    I configured the application to use the Classic .NET application pool and tried playing with the Maximum worker processes, first setting it to 4 but put it back to 1 as it did not have the expected result. Are there any other things that I can try?

  • Nyla Pareska
    Nyla Pareska over 14 years
    I know of the first time hit on ASP.NET being slow but it is every successive call also. Since I am using ASP.NET and WCF and jQuery. The first time hit on the page takes almost 2 minutes and then I have a call in document ready for a call to my WCF service, which also takes almost 2 minutes. Not really fun to test my applications.
  • Nyla Pareska
    Nyla Pareska over 14 years
    I will try this out next week at work. Hopefully it does what I hope for.
  • BuildTheRobots
    BuildTheRobots over 14 years
    its been mentioned that the windows 7 hosts file has the localhost entries commented out, so it seems likely.
  • Nyla Pareska
    Nyla Pareska over 14 years
    Where can I find that hosts file and what do I have to put in it?
  • jasonpenny
    jasonpenny over 14 years
    %WINDIR%\System32\drivers\etc\hosts, remove the "#" before 127.0.0.1 [see wagnerdanda.me/2009/12/… ]
  • Shinigamae
    Shinigamae over 6 years
    this saved my life. The additional part is the solution. Instead of v2.0 folder, you need to do the same thing for v4.0 folder for .NET 4.0 and later