I want to use iis 7 instead of iis express in visual web developer 2010

此生再无相见时 提交于 2019-11-30 04:21:03

问题


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.


回答1:


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:


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".




回答3:


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.




回答4:


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.




回答5:


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.



来源:https://stackoverflow.com/questions/10192801/i-want-to-use-iis-7-instead-of-iis-express-in-visual-web-developer-2010

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!