Search code examples
visual-studio-2013iis-express

Unable to launch/debug ASP.NET Web Site after upgrading to Visual Studio 2013


I've just installed Visual Studio (Ultimate) on my development machine. The install seemed to go fine, but when I try to run a VS2012 ASP.NET Web Application project, IE launches and gives me:

Error: Internet Explorer cannot display the webpage

IIS Express is installed, and the project is set to use IIS Express:

VS2013 showing the project set to use IIS Express

IIS Express is running, the port is open etc, but it doesn't appear to be serving any webpages. If I look in the IIS Express logs, I can see the requests being returned with what looks like a 303 error:

2013-12-23 14:22:49 ::1 GET /login.aspx - 25869 - ::1 Mozilla/5.0+(compatible;+MSIE+9.0;+Windows+NT+6.1;+WOW64;+Trident/5.0) - 303 0 0 0
2013-12-23 14:22:53 ::1 GET /login.aspx - 25869 - ::1 Mozilla/5.0+(compatible;+MSIE+9.0;+Windows+NT+6.1;+WOW64;+Trident/5.0) - 303 0 0 0

Any ideas what I need to do/undo to get VS2013 running my project?


Solution

  • Cracked it. My 'web.config' file had the following rewrite rule:

    <rewrite>
      <rules>
        <rule name="Redirect to HTTPS" stopProcessing="true">
          <match url="(.*)"/>
          <conditions>
            <add input="{HTTPS}" pattern="^OFF$"/>
          </conditions>
          <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther"/>
        </rule>
      </rules>
    </rewrite>
    

    ... which would force HTTPS on the live site. This didn't cause a problem when using VS2012's Cassini development web server, but as that's now been replaced it seems that IIS Express is trying to enact the rewrite rule. I'm not sure if the URL Rewrite module is available or compatible with IIS Express, but I can easily comment out the offending lines for now and leave them in place on the live site.