Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using port 80 with IIS Express inside of VS2010

I've got an app that I am trying to run on my dev system under IIS Express from VS2010 that I need to use port 80 for, but I can't get it to work. I've looking up information talking about port 80 being reserved. http://learn.iis.net/page.aspx/1005/handling-url-binding-failures-in-iis-express/

But even after doing that I still get an error from vs2010 that says "Unable to launch the IIS Express Web server. Port '80' is in use."

I don't know what else to try. I've used Process Hacker to track down port 80 and it seems to be used by System running on process ID 4, which is the NT Kernel and System process. I don't know if that would prevent me from using the port though. I thought maybe that was a result of http.sys holding that port so nothing else could use it?

I did managed to get IIS Express to run on port 80 by modifying the default binding of the C:\Users\[MyUser]\Documents\IISExpress\config\applicationhost.config file, and while I can start IIS Express manually this way, VS then gets an error because a binding already exists on that port. So I change it back to 8080, create the virtual directory using the button within VS2010 (which I'm guessing is the same as entering a site binding) but I still get an error when I go to debug the application. Is there something hardcoded in VS2010 that won't let it start IIS Express on port 80?

UPDATE & FIX: Ok, so I found a few more things to check and I did resolve my problem but not completely. One post suggested making sure I did not have SQL reporting services installed as it can monitor on port 80, I used to have it installed but not anymore and was not the problem I was encountering. I did however realize that I have WebDeploy installed. It was bundled with the VS2010 SP1 bundle from the Web Platform Installer. This is fine as I do want the client tools from WebDeploy, but it also installed the agent on my system which was monitoring on port 80. I went to my list of services and stopped the Web Deploy Agent Service. Soon as I did this I can now use port 80 for IIS Express from within VS2010.

New Issue related to running on port 80 in IIS Express However my application is an MVC3 App, and I've run into a problem because the MVC3 isn't capturing my request at all, so It's not firing my controller actions or anything like that, but a txt file in the root of my app can be reached so I know it's my site that IIS Express is serving up. Anyone have any issues running an MVC3 (I don't know if it's exclusive to MVC3 or not) in IIS Express on port 80?

like image 289
Nick Albrecht Avatar asked Apr 15 '11 00:04

Nick Albrecht


People also ask

How do I run IIS on port 80?

Double-click Internet Information Services (IIS) Manager. In the Internet Information Services dialog box, expand local computer ►Sites and right click Default Website and select Bindings. Select the http setting and click Edit. Change the port number to 80 and click OK.

What port does IIS Express use?

By default, you can use IIS Express to run your website using a non-reserved port such as 8080. However, using a reserved port such as 80 or 443 requires work.

How do I change the port for IIS Express?

In Solution Explorer, right-click the name of the application and then select Properties. Click the Web tab. In the Servers section, under Use Local IIS Web server, in the Project URL box change the port number. To the right of the Project URL box, click Create Virtual Directory, and then click OK.

How do I access IIS Express from another machine?

Normally when you run an application in IIS Express, it's only accessible on http://localhost:[someport]. In order to access it from another machine, it needs to be bound to your public IP address as well. Open* D:\Users[YourName]\Documents\IISExpress\config\applicationhost. config *and find your site.


3 Answers

Just posting my own answer for this problem so I can mark the question as answered. Check http://learn.iis.net/page.aspx/1005/handling-url-binding-failures-in-iis-express/ Disable the Web Deploy Agent service if you have it installed.

like image 170
Nick Albrecht Avatar answered Oct 18 '22 08:10

Nick Albrecht


in my case i solved the issue by stop "SQL Server Reporting Services"

you can find it in

control panel -> sevices

like image 38
Nour Sammour Avatar answered Oct 18 '22 07:10

Nour Sammour


THANK YOU very much for you discovering of the 'Web Deploy Agent' service! This is something that only recently got turned on as I had all this working perfectly and just today installed the updated version of IIS Express, and ran into the exact same problem with port 80. So now that I have turned off the Web Deploy agent, my system works correctly again.

As for ASP.NET MVC3, that works great for me on port 80 and port 443. It was quite a bit of work to bind both those ports so that IIS Express was able to use them as a normal user (most of it from the link you posted above), and to install the SSL certificate we use. I manually created all the entries in my applicationhost.config file to get this working, and the appropriate sites section is below:

    <sites>
        <site name="PHP: A Main" id="2144116512">
            <application path="/">
                <virtualDirectory path="/" physicalPath="C:\var\www\amain\www" />
                <virtualDirectory path="/images" physicalPath="C:\var\www\images" />
            </application>
            <application path="/admin">
                <virtualDirectory path="/" physicalPath="C:\var\www\amain\www\admin" />
            </application>
            <bindings>
                <binding protocol="http" bindingInformation="*:80:test.amainhobbies.com" />
                <binding protocol="https" bindingInformation="*:443:test.amainhobbies.com" />
            </bindings>
        </site>
        <siteDefaults>
            <logFile logFormat="W3C" directory="%IIS_USER_HOME%\Logs" />
            <traceFailedRequestsLogging directory="%IIS_USER_HOME%\TraceLogFiles" enabled="true" maxLogFileSizeKB="1024" />
        </siteDefaults>
        <applicationDefaults applicationPool="Clr4IntegratedAppPool" />
        <virtualDirectoryDefaults allowSubDirConfig="true" />
    </sites>

Note that my site is a combined PHP and ASP.NET MVC3 site, as we are in the process of re-writing the entire thing to run on ASP.NET MVC3, so most of the site is still PHP but lots of new stuff is now running ASP.NET MVC3, and that stuff works for me.

Does your IIS Express work properly with MVC3 outside of Visual Studio, or is the MVC3 stuff just not working at all?

like image 3
Kendall Bennett Avatar answered Oct 18 '22 08:10

Kendall Bennett