VS 2012 can't load project which uses IIS with custom binding host - thinks it's using IIS Express

asp.netIisVisual Studio-2012Iis Express

asp.net Problem Overview


I have an ASP.NET project which uses IIS. IIS site is configured to use custom binding host name. Project file contains following settings:

...
<UseIISExpress>false</UseIISExpress>
...
<ProjectExtensions>
  <VisualStudio>
    <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
      <WebProjectProperties>
        <UseIIS>True</UseIIS>
        <AutoAssignPort>False</AutoAssignPort>
        <DevelopmentServerPort>8662</DevelopmentServerPort>
        <DevelopmentServerVPath>/</DevelopmentServerVPath>
        <IISUrl>http://custom.host.name/</IISUrl>
        <NTLMAuthentication>False</NTLMAuthentication>
        <UseCustomServer>False</UseCustomServer>
        <CustomServerUrl></CustomServerUrl>
        <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
      </WebProjectProperties>
    </FlavorProperties>
  </VisualStudio>
</ProjectExtensions>
...

When project is configured in such a way, I can access the site from http://custom.host.name/ and VS automatically attaches to IIS worker process when debugging.

When I reload project (either by closing/reopening solution or by unload/reload in project context menu), something unexpected happens. Project fails to load, (load failed) is displayed to the right of project name in solution explorer and message box is shown with the following message (it's also displayed in the Output window):

The URL 'http://custom.host.name/' for Web project 'Some.Asp.Net.Project' 
is configured to use IIS Express as the web server but the URL is currently
configured on the local IIS web server. To open this project, you must use
IIS Manager to remove the bindings using this URL from the local IIS web server.

I have tried removing project site configuration from IIS Express applicationhost.config file, but it didn't help.

I don't encounter this problem when mapping project to IIS Application under default site.

VS version is Ultimate 2012 Update 3.

asp.net Solutions


Solution 1 - asp.net

Opening as an Administrator didn't fix the problem for me. What fixed it for me was opening both the .csproj and .csproj.user files and ensuring that both had UseIISExpress set to false.

In my case, the .csproj.user file was overriding the .csproj file even though SaveServerSettingsInUserFile was marked false.

<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <UseIISExpress>false</UseIISExpress> 
    <!-- ... -->
</Project>

Solution 2 - asp.net

The solution is: delete *.csproj.user file!

Solution 3 - asp.net

I have set "SaveServerSettingsInUserFile" as True and it worked for me.

<ProjectExtensions>
<VisualStudio>
  <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
    <WebProjectProperties>
      <UseIIS>True</UseIIS>
      <AutoAssignPort>True</AutoAssignPort>
      <DevelopmentServerPort>50584</DevelopmentServerPort>
      <DevelopmentServerVPath>/</DevelopmentServerVPath>
      <IISUrl>http://localhost:50584/</IISUrl>
      <NTLMAuthentication>False</NTLMAuthentication>
      <UseCustomServer>False</UseCustomServer>
      <CustomServerUrl>
      </CustomServerUrl>
      <SaveServerSettingsInUserFile>True</SaveServerSettingsInUserFile>
    </WebProjectProperties>
  </FlavorProperties>
</VisualStudio>

Source : click here

Solution 4 - asp.net

when you use enable the use for IISexpress, the applicationHost.Config (located in %userprofile%\iisexpress\config), you have to check the option "Apply Server settings to all users (store in project file)" to avoid your settings written in yourProject.csproj.user ![project settings][1]

doing this is the same as editing your project.csproj file and writing <WebProjectProperties> <UseIIS>True</UseIIS> <AutoAssignPort>True</AutoAssignPort> <DevelopmentServerPort>62242</DevelopmentServerPort> <DevelopmentServerVPath>/</DevelopmentServerVPath> <IISUrl>http://localhost:8100/Claims/</IISUrl> <OverrideIISAppRootUrl>True</OverrideIISAppRootUrl> <IISAppRootUrl>http://localhost:8100/Claims/</IISAppRootUrl> <NTLMAuthentication>False</NTLMAuthentication> <UseCustomServer>False</UseCustomServer> <CustomServerUrl></CustomServerUrl> <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile> </WebProjectProperties> If you enable IISExpress and your applicationHost.config file doesn't contain the entry related to your project settings, you just have to push the button "Create Virtual Directory" and done!

hope this helps [1]: http://i.stack.imgur.com/A9Int.png

Solution 5 - asp.net

In my case deleting the *.csproj.user file worked fine

Solution 6 - asp.net

I had the same issue, for me all i had to do was open visual studio as an administrator and this resolved the issue for me.

so simple right click on the visual studio 2012 and click "run as administrator". hope this helps

Solution 7 - asp.net

For me combination of both worked for Visual Studio 2015 Preview with Windows 7 64 bit:

  1. delete *.csproj.user file and
  2. <UseIISExpress>false</UseIISExpress> in Solution File.
    Steps for Step 2:In Visual Studio Right Click on Project==> Unload ===> Edit the Solution

Solution 8 - asp.net

This is enough

Comment this line in project file x.csproj

<!--<UseIIS>True</UseIIS>-->

x.csproj : error : The URL 'http://localhost/x'; for Web project 'x' is configured to use IIS Express as the web server but the URL is currently configured on the local IIS web server. To open this project, you must use IIS Manager to remove the bindings using this URL from the local IIS web server.

Solution 9 - asp.net

I landed here when a project, configured to use IIS, wouldn't load because it couldn't find the web site (myproject.mycompany.local)--even though the web site loaded fine in my web browser.

The solution was to make sure the site's binding in IIS 7 had the host name set to "myproject.mycompany.local". To get to your site's bindings:

  1. In IIS 7, select the site in the left navigation panel.
  2. In the Actions panel on the right, click Bindings...

If you site doesn't load in the web browser either, it's probably because you don't have an entry for it in your hosts file:

127.0.0.1    myproject.mycompany.local

Solution 10 - asp.net

If your project is part of a solution, Open the solution file (.sln) and edit the project section.

ProjectSection(WebsiteProperties) = preProject
	UseIISExpress = "false"

It Worked for me.

Solution 11 - asp.net

This problem was ruining my day in VS 2013 today. I tried all of the above, but didn't get the project to load until I created a Web site in IIS and filled in this section in the .csproj file (especially the IISUrl element):

<ProjectExtensions>
    <VisualStudio>
      <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
        <WebProjectProperties>
          <UseIIS>True</UseIIS>
          <AutoAssignPort>True</AutoAssignPort>
          <DevelopmentServerPort>81</DevelopmentServerPort>
          <DevelopmentServerVPath>/</DevelopmentServerVPath>
          <IISUrl>http://localhost/SomeProject</IISUrl>
          <NTLMAuthentication>False</NTLMAuthentication>
          <UseCustomServer>False</UseCustomServer>
          <CustomServerUrl>
          </CustomServerUrl>
          <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
        </WebProjectProperties>
      </FlavorProperties>
    </VisualStudio>

Solution 12 - asp.net

I had the same issue, running as administrator didn't work for me.

Setting <UseIIS>True</UseIIS> to false in project's ".csproj" file temporarily could load the project, but value was returning to True after restarting or closing the solution.

Completing @Cyrus 's answer (that worked for me) for a more neat answer, I focused more on project's csproj.user file and found the exact source of problem: setting <UseIISExpress>true</UseIISExpress> to false, then reloaded the project. working good, without deleting csproj.user file. result is like this:

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <ProjectView>ProjectFiles</ProjectView>
    <UseIISExpress>false</UseIISExpress>
    <IISExpressSSLPort />
    <IISExpressAnonymousAuthentication />
    <IISExpressWindowsAuthentication />
    <IISExpressUseClassicPipelineMode />
    <NameOfLastUsedPublishProfile>My Project's Name</NameOfLastUsedPublishProfile>
  </PropertyGroup>

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionIgor AntonovView Question on Stackoverflow
Solution 1 - asp.netJonahView Answer on Stackoverflow
Solution 2 - asp.netCyrusView Answer on Stackoverflow
Solution 3 - asp.netLiakat Ali MondolView Answer on Stackoverflow
Solution 4 - asp.netzobidaflyView Answer on Stackoverflow
Solution 5 - asp.netHaddisView Answer on Stackoverflow
Solution 6 - asp.netGautam BeriView Answer on Stackoverflow
Solution 7 - asp.netSunil YadavView Answer on Stackoverflow
Solution 8 - asp.netsamar samarView Answer on Stackoverflow
Solution 9 - asp.netSethView Answer on Stackoverflow
Solution 10 - asp.netMr NsubugaView Answer on Stackoverflow
Solution 11 - asp.netEric FarrView Answer on Stackoverflow
Solution 12 - asp.netHoma Pour MohammadiView Answer on Stackoverflow