SharePoint Event ID 6482: Could not find file 'C:WINDOWSsystem32driversetcHOSTS'.

Typically I won't blog about an error until I've encountered it a few times.  Here's an exception to the rule.  smile_sniff  I had never come across this error and it caught me off guard during a recent installation of MOSS.  Usually when I've seen Event ID 6482, it's been because of the IIS lock (see previous post: SharePoint Exception Errors: Event ID 6398, Event ID 6482, Event ID 7076).  However, this was a different error description.

So why on earth is my hosts file missing?  After some online research, it appears that the host file is deleted/modified by the SharePoint timer service after you've made some changes to the WFE that is crawled by the search service.

Error Detail:

image

Event Type: Error
Event Source: Office SharePoint Server
Event Category: Office Server Shared Services
Event ID: 6482 Date: 11/12/2008
Time: 8:37:54 PM
User: N/A
Computer: YOURSERVER
Description:
Application Server Administration job failed for service instance Microsoft.Office.Server.Search.Administration.SearchServiceInstance (dbb94537-db22-448b-92c9-d1f684a4a13e).

Reason: Could not find file 'C:\WINDOWS\system32\drivers\etc\HOSTS'.

Techinal Support Details:
System.IO.FileNotFoundException: Could not find file 'C:\WINDOWS\system32\drivers\etc\HOSTS'.
File name: 'C:\WINDOWS\system32\drivers\etc\HOSTS'
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)
at System.IO.FileInfo.OpenText()
at Microsoft.Search.Administration.Security.HOSTSFile.ParseHOSTSFile(Hashtable& HOSTSFileMappings, StringBuilder& HOSTSComments)
at Microsoft.Search.Administration.Security.HOSTSFile.ConfigureDedicatedGathering(SearchServiceInstance searchServiceInstance, SPServer dedicatedWebFrontEndServer, IList`1 previousWebApplicationHostNames)
at Microsoft.Office.Server.Search.Administration.SearchServiceInstance.SynchronizeDefaultContentSource(IDictionary applications)
at Microsoft.Office.Server.Search.Administration.SearchServiceInstance.Synchronize()
at Microsoft.Office.Server.Administration.ApplicationServerJob.ProvisionLocalSharedServiceInstances(Boolean isAdministrationServiceJob)

For more information, see Help and Support Center at https://go.microsoft.com/fwlink/events.asp .

Error Resolution:

To resolve this error, you have two things you have to do.

  1. Create a new hosts file at C:\Windows\system32\drivers\etc\

    image 

    The contents of a default hosts file typically looks like this:

     # Copyright (c) 1993-1999 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
    # space.
    #
    # Additionally, comments (such as these) may be inserted on individual
    # lines or following the machine name denoted by a '#' symbol.
    #
    # For example:
    #
    #      102.54.94.97     rhino.acme.com          # source server
    #       38.25.63.10     x.acme.com              # x client host
    
    127.0.0.1       localhost
    
  2. Once you've created the hosts file, you need to apply appropriate permissions for WSS_Admin_WPG to it.  If you don't, you are just going to encounter another error (This time a permission error:

    Access to the path 'C:\WINDOWS\system32\drivers\etc\HOSTS' is denied).
    image

- Dan