While attempting to install a new Sitecore instance for version 10.3,

I encountered the following error: Unable to get lock on file C:\WINDOWS\system32\drivers\etc\hosts after 10 attempt(s).

I have explored several resources suggesting adjustments to *.json files, but I am uncertain if this is the appropriate solution. Below is a screenshot of the error message for reference.

enter image description here

3 Answers 3


Sometimes this issue comes because of firewall settings so if you check firewall settings then it should work.

Alternatively, you can manually add host entries and remove CreateHostHeader from the below JSON.

  1. sitecore-XP0.json
  2. xconnect-xp0.json
  3. IdentityServer.json

More detail you can find here https://sitecorecorner.wordpress.com/2020/11/01/unable-to-update-hosts-file-while-installing-sitecore-10-using-sia/


The error occurred while executing CreateHostHeader task of installation process. This step updates hosts file to add host entries for Sitecore, Identity Server and xConnect sites of XP0 Single instance.

There are 2 solutions -

Solution1: There is a workaround and did following steps:

  1. Updated hosts file manually and added following hosts entries: sc10.identityserver.dev.local sc10.xconnect.dev.local sc10.sc.dev.local

  2. Then, removed CreateHostHeader task from following files:




You can find these files in installation package. These files have required configurations to setup Sitecore instance. You can find following configuration for CreateHostHeader task in Tasks list:

"CreateHostHeader": {
            "Description": "Sets a hostheader for the website.",
            "Type": "HostHeader",
            "Params": {
                "HostName": "[parameter('HostMappingName')]"
            "Skip": "[not(parameter('HostMappingName'))]"

The installation was successful with this workaround. Reference - https://sitecorecorner.wordpress.com/2020/11/01/unable-to-update-hosts-file-while-installing-sitecore-10-using-sia/


1). This error came during installing Sitecore 9.3 in some VM-virtual machines. So first try to give admin access to that VM. After providing admin access, there is a need to restart the VM again.

2). You can follow below articles also in this matter – https://superuser.com/questions/968359/windows-10-hosts-file-used-by-another-process https://www.cnet.com/forums/discussions/c-windows-system32-drivers-etc-hosts-file-cannot-saved-351660/

Reference - https://krishankanoria.wordpress.com/2020/08/27/issues-while-installing-sitecore-v9-3/


There might be 2 possibilities :

  1. Check whether the host file is being locked by firewall/antivirus.
  2. The host file might be in read-only mode.

Can you check to remove read-only attribute from host file or remove the lock of the file acquired from another process.

You can use Process Explorer to find whether the file is being locked by another process: https://learn.microsoft.com/en-us/sysinternals/downloads/process-explorer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.