8
votes

I am having some trouble setting up my vwd 2010 environment to run under my local iis 7.5 instead of iis express.

Whenever I go to the project properties and select the 'web' tab, I choose under Servers, 'Local iis web server'. It automatically puts in the Project URL http://localhost/myprojectname.

I click Create Virtual Directory and it comes up with this warning,,,

'Unable to create the virtual directory. The site ofr the url http://localhost/myprojectname exists on both the local IIS Web server and the IIS Express web server. You need to edit the 'c:\Users\Mike\Documents\iisexpress\config\applicationhost.config' file to change the port number in use by iis express or use iis manager to change the sites binding(s) in iis.'

Your help is greatly appreciated in explaining why I can't use the built in functionality to use iis 7.5 instead of iis express.

Thank you in advance.

5

5 Answers

10
votes

This issue can happen because there is a site setup in IISExpress bound to port 80, which is also used by regular IIS.

Open up the applicationhost.config as it mentions and look for something like:


<site name="SomeAppName-Site" id="15">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
    <virtualDirectory path="/" physicalPath="C:\Users\YourName\Documents\My Web Sites\SomeProjectsWebSite" />
    </application>
    <bindings>
       <binding protocol="http" bindingInformation="*:80:localhost" />
    </bindings>
</site>

Note the part that says :80 change this to some other port so it's not shared with 80, and not in use by another application in IISExpress. You can look over the other site nodes in applicationhost.config to find one not used, or try 8081 for starters.

2
votes

in the applicationhost.config, locate the site's name and remove its site section.. then try to reload your web site project again

Edited:

1) Find the "myprojectname" site in the applicationhost.config and completely delete its section

<site name="myprojectname" id="15">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
    <virtualDirectory path="/" physicalPath="C:\Users\YourName\Documents\My Web Sites\SomeProjectsWebSite" />
    </application>
    <bindings>
       <binding protocol="http" bindingInformation="*:80:localhost" />
    </bindings>
</site>

2) In visual studio under the solution explorer, right click on the project and then select "Reload project".

1
votes

I did try the suggestions where you remove the site from the applicationHost.config file, in these locations:

IIS Express:

%userprofile%\documents\iisexpress\config\applicationHost.config

%userprofile%\my documents\iisexpress\config\applicationHost.config

IIS:

%WINDIR%\System32\inetsrv\config\applicationHost.config

However, that did not work for me. I found that I also had to delete/rename the project's user file located within the Visual Studio project folder.

Example C# project name is: MyProject

The file to rename/delete: MyProject.csproj.user

It's an xml file which does have some stored settings about the web project.

I closed VS. Renamed the file. Opened VS, and the project loaded just fine.

0
votes

You probably already have a website called "myprojectname" set up in IIS. Go to the config file that it mentions and find the place where that project is defined. Remove that node from the XML, and try again.

0
votes

I ran into the same issue and decided to select "Use Custom Web Server", instead of "Use Local Web Server".

I set up my site in my local IIS 7 to be at "http://localhost:8080" (another app is already using port 80). Then, I just put that into the "Server URL" box.

She's working like a charm, huzzah.