Skip to content

Instantly share code, notes, and snippets.

@MFry
Last active April 5, 2017 23:24
Show Gist options
  • Save MFry/9e3d823daec1f7f3294f468d075dc5d5 to your computer and use it in GitHub Desktop.
Save MFry/9e3d823daec1f7f3294f468d075dc5d5 to your computer and use it in GitHub Desktop.
Changing IISExpress port for Website Project

If you are getting the following error after trying to debug a website project:

Unable to launch the IIS Express Web server.

Failed to register URL "http://localhost:62940/" for site "SITE NAME" application "/". Error description: Access is denied. (0x80070005).

and if windows managed to reserve the specific port (such as 62940) you might want to change the port of your projects IISExpress server. (You can check what ports are being used by running netstat. You can also try killing Microsoft.VisualStudio.Web.Host.exe*32. Alas, if none of that works locate your project.sln (where project is the name of your specific project) and you can edit the port.

I did a string replace of all mentions of 62940 and replaced it with 65534. So my server names became localhost_65534, but I suspect it might have simply worked by changing VWDPort, but it made it more consistant to change everything and it worked, so I left it alone.

I ultimately went one with a "dynamic port [in the] range of 49152 through 65535", to avoid further collisions.

Stack Overflow and Google are my heros and my references are:

Unable to launch the IIS Express Web server, Failed to register URL, Access is denied

Changing project port number in Visual Studio 2013

The default dynamic port range for TCP/IP has changed in Windows Vista and in Windows Server 2008

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26228.10
MinimumVisualStudioVersion = 10.0.40219.1
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "projectname", ".", "{C8FFF6CD-9C59-4BB8-89C7-ED3F35D7CD32}"
ProjectSection(WebsiteProperties) = preProject
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0"
Debug.AspNetCompiler.VirtualPath = "/localhost_65534"
Debug.AspNetCompiler.PhysicalPath = "..\project_root\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_65534\"
Debug.AspNetCompiler.Updateable = "true"
Debug.AspNetCompiler.ForceOverwrite = "true"
Debug.AspNetCompiler.FixedNames = "false"
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.VirtualPath = "/localhost_65534"
Release.AspNetCompiler.PhysicalPath = "..\project_root\"
Release.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_65534\"
Release.AspNetCompiler.Updateable = "true"
Release.AspNetCompiler.ForceOverwrite = "true"
Release.AspNetCompiler.FixedNames = "false"
Release.AspNetCompiler.Debug = "False"
VWDPort = "65534"
SlnRelativePath = "..\project_root\"
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C8FFF6CD-9C59-4BB8-89C7-ED3F35D7CD32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C8FFF6CD-9C59-4BB8-89C7-ED3F35D7CD32}.Debug|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment