Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot start IIS Express

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
like image 280
BartoszCichecki Avatar asked Feb 24 '14 13:02

BartoszCichecki


2 Answers

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?

like image 188
Mike Mengell Avatar answered Nov 18 '22 07:11

Mike Mengell


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.

like image 13
Vaibhav D Avatar answered Nov 18 '22 09:11

Vaibhav D