Using the HOSTS file for SharePoint Development
When doing development on a SharePoint development server, there may be the need to create multiple web applications. To prevent conflicts there are two possibilities: either use host headers or use a different port. To support host headers we can either add additional DNS entries or use the HOSTS file (C:Windows\System32\drivers\etc).
Since my development servers generally run as isolated Virtual Machine’s, creating DNS entries isn’t an option. As a result I’ll commonly make modifications to the HOSTS file such as:
# Copyright (c) 1993-2009 Microsoft Corp.
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
# For example:
# 18.104.22.168 rhino.acme.com # source server
# 22.214.171.124 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
The problem with this approach is that when attempting to a web application that’s been configured in this manner from the development server, Browser will be unable to connect.
This problem isn’t specific to SharePoint, it’s actually a security feature that’s been built into Windows 2003 and later. It just so happens that when we’re building SharePoint applications, we generally do development on the server and therefore the problem raises it’s head.
The solution is to disable the loopback check by setting the DisableLoopbackCheck registry key.
To set the DisableLoopbackCheck registry key, follow these steps:
- Click Start, click Run, type regedit, and then click OK.
- In Registry Editor, locate and then click the following registry key:
- Right-click Lsa, point to New, and then click DWORD Value.
- Type DisableLoopbackCheck, and then press ENTER.
- Right-click DisableLoopbackCheck, and then click Modify.
- In the Value data box, type 1, and then click OK.
- Quit Registry Editor, and then restart your computer.
For further details of this problem and the implications of making this change see: http://support.microsoft.com/kb/896861