SharePoint weird delay on first load

.net asp.net optimisation performance sharepoint technology

Are you seeing ridiculous delays in your SharePoint web app spinning up with little activity on the server? Is it take over 2 minutes to display the first page after an app pool recycle?

Does your server have access to the internet? No? This will cause delays when a signed piece of .NET code runs

Every time some managed .NET code tries to run, the .NET Framework is trying to contact crl.microsoft.com. Now if your server is offline (think VM on a laptop on a plane), or your server doesn’t have access to the internet at all, or possibly through a proxy server, then these attempts to contact crl.microsoft.com will add a delay to start up time of things like SharePoint web apps as the connection attempt times out.

This affects all .NET apps since version 2.0 of the Framework. I’ve seen weird things trying to activate a CRM 2011 SharePoint List Component that just wouldn’t work until we applied one of these workarounds.

Workaround:

Hack your hosts file to add an entry for 127.0.0.1 crl.microsoft.com

Use this to quickly validate if this is part of your performance problem.

image

If doing this decreases your startup time (i.e. saves you about 90 seconds) and you want to make a more ‘proper’ change, then you need to add an entry to the machine.config file on your server.

See http://msdn.microsoft.com/en-us/library/bb629393.aspx for more info about this setting.

For a more detailed discussion of this issue, see the TechNet wiki entry