Failed to register URL “http://localhost:XXXX/” for site “SITE NAME” application “/”. Error description: The process cannot access the file because it is being used by another process. (0x80070020)
**XXXX = port number
Reason for this error:
This error happens to me because I was using same solution for different project. I copied the solution and created another one in different location.
I have done several another projects in same way, however, I didn’t face this error earlier. I think, the localhost with the port has been researved for the previous actual solution. Since I created seperate project in TFS and then clone the solution local location with same solution name in different location.
Right click on project select Unload project
Again Right click and select Edit ProjectName.csproj
remove these 3 lines
<DevelopmentServerPort>0</DevelopmentServerPort> <DevelopmentServerVPath>/</DevelopmentServerVPath> <IISUrl>http://localhost:62940/</IISUrl>
Save and reload the project
Then, you will get new port for the project.
If you find any another solution, please comment.