32

I has just installed Visual Studio 2012 and wanted to create my first WCF Service Application. I am a Java developer coming to .NET world, so please be understanding :)

I have created a new C# project WCF Service Application. Then I hit Debug (or F5) and I get an error saying:

Unable to launch IIS Express

When I click again there is another error like this, but this time IIS appears in tray and I get a notification (bubble) and when I click it there is a message saying:

Port '53234' is already being used by process 'IIS Express' (process ID '5524')

I have tried changing the port in project properties in Web tab, but it does not change anything. The msgs are the same, just the port number changes.

For me this is quite funny, but I cannot fix it. Already tried changing the ports, I reinstalled IIS, restarting Visual Studio and PC. Nothing is running on the ports that I want to use.

I am using Windows 8.1 x64, Visual Studio 2012 (IIS 8).

EDIT

There is a log msg in IIS:

Failed to register URL "http://localhost:53234/" for site "WcfService1" application "/". Error description: Cannot create a file when that file already exists. (0x800700b7)
Registration completed
BartoszCichecki
  • 2,227
  • 4
  • 28
  • 41
  • 2
    Seems like the service is already running. Have you tried to reboot? – Hexo Feb 24 '14 at 13:09
  • THanks MattC. Stupid typos. – BartoszCichecki Feb 24 '14 at 13:09
  • 2
    Yes I tried rebooting. – BartoszCichecki Feb 24 '14 at 13:10
  • 1
    Check this http://stackoverflow.com/questions/14762646/debugging-mvc-application-in-vs2012-attempts-to-start-iis-express-twice – Hexo Feb 24 '14 at 13:11
  • 1
    Also try, [MSDN](https://connect.microsoft.com/VisualStudio/feedback/details/778864/vs2012-is-spawning-two-iisexpress-processes-when-attempting-to-debug) or http://stackoverflow.com/questions/14660366/unable-to-launch-web-server – MattC Feb 24 '14 at 13:13
  • you are using IIS or IIS express? i guess something is wrong with your iis express. please try host your wcf application in iis and send the result.(remember add your host name to the host file.) – Mohammad Oct 04 '15 at 13:06
  • When you start an instance of IIS Express, make sure all instances are closed. If you were to open a new tab in that instance of IIS Express and only close your 'website', you will still get "Port '53234' is already being used by process 'IIS Express'' – LinkedListT Jan 18 '20 at 13:38

8 Answers8

41

For me this problem was due to a misconfiguration in the project which manifested itself in IISExpress' applicationHost.config file.

I had both the http and https ports setup as the same.

            <site name="{projectname}" id="3">
            <application path="/" applicationPool="Clr4IntegratedAppPool">
                <virtualDirectory path="/" physicalPath="{myPath}" />
            </application>
            <bindings>
                <binding protocol="https" bindingInformation="*:57287:localhost" />
                <binding protocol="http" bindingInformation="*:57287:localhost" />
            </bindings>
        </site>

To solve this edit the project file to correctly use different ports.

Another option is to delete the applicationHost.config file, Visual Studio will recreate it when it fires up IISExpress. It won't solve a project misconfiguration but it might solve a currupt configuration which I've had to do a few times.

*Note: * To find your applicationHost.config file for IIS see this question Where is the IIS Express configuration / metabase file found?

Community
  • 1
  • 1
Mike Mengell
  • 2,310
  • 2
  • 21
  • 35
14

I was facing the same issue and what I did is as follow:

  • Go to Project Properties -> Web
  • Change the port number and click on Create virtual directory button

Now you will be able to run the application without any error.

Vaibhav D
  • 605
  • 9
  • 12
  • Also make sure that the port you choose is not in any excluded ranges: https://gunnarpeipman.com/failed-to-register-url-for-site/ – Tyson Gibby May 19 '21 at 14:21
11

I ran into this recently and my solution wasn't here, so I figured I'd add it.

My issue was that netsh had a urlacl added that matched my localhost binding, causing this error message.

The solution is to call netsh http show urlacl and look and see if your iis express binding are listed. My localhost binding was for https://localhost:44300. So to fix it, I had to call:

netsh http delete urlacl url=https://localhost:44300/

mccow002
  • 6,754
  • 3
  • 26
  • 36
  • 1
    This was my issue as well. It was caused by a previous binding for another site, and ended up doing a full reservation on the port. Thank you very much! – Joshua Jan 19 '17 at 14:56
4

I encountered this issue when I had two instances of Visual Studio 2012 open with different projects that happened to have the same name (default name of App).

I was able to resolve this by closing one instance of Visual Studio.

Tristan Reischl
  • 251
  • 4
  • 8
2

The root cause of the problem for me was that I had a website running in Local IIS which was bound to the same port as the one I was trying to start up via Visual Studio's IIS Express. The Visual Studio debugger would start up, and everything would look fine, but no dlls were loaded and the memory graph was just a flat line at 13[MB] no matter what I did on the website (which was actually the version being served by Local IIS).

So, I just needed to change one of the port numbers.

N73k
  • 527
  • 8
  • 20
1

I tried netsh http show urlacl and didn't see my address, my applicationHost.config file looked correct, and there was nothing troubling inside IIS. I fixed it by closing Visual Studio, deleting the .vs directory out of the solution folder, and restarting Visual Studio.

sirdank
  • 3,351
  • 3
  • 25
  • 58
0

For me this happened only (in visual studio 2019) when I did Ctrl+F5 (start without debugging) but had no problems when debugging. @Mike Mengells answer put me on the right track. In my project properties I switched "SSL Enabled" from true to false and all was good :)

Bjarki B
  • 709
  • 7
  • 11
0

My problem is that it was trying to launch using SSL with a URL Like this:

https://localhost:34342/

I removed the "s" from https, and then it worked.

John Gilmer
  • 831
  • 1
  • 11
  • 18