Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual studio not creating virtual directory

I am stuck here in deploying my application to the local IIS server.

First of all my system doesn't have IIS manager then I get this by adding features to windows to enable that.

My IIS manager is IIS express 8.0 and using windows 10 with visual studio 2012

Now the problem is:

I created a web application and wants to deploy it in Local IIS server as: Right click on Project in VS->Properties->Web->and selected local iis server radioButton

But got the error in result as

The site for the Url.... exists on both local iis web server and the iis express web server. You need to edit the applictionhost.config file to change the port number used by iis express or change the bindings in iis manager.

How can I deploy my application to the local IIS server?

like image 319
hemantsharma Avatar asked Aug 29 '15 13:08

hemantsharma


People also ask

How do I create a virtual directory in Visual Studio?

In Visual Studio, on the File menu, click New and then click Web Site. In the New Web Site dialog box, click Browse. In the Choose Location dialog box, click the Local IIS icon. You must be a member of the Administrators group on the local computer to access the IIS metabase and create a virtual directory.

How do I create a virtual directory?

Right-click the Web site that you want (for example, Default Web Site), point to New, and then click Virtual Directory. On the Welcome to the Virtual Directory Creation Wizard page, click Next. On the Virtual Directory Alias page, type the alias that you want (for example, Sales), and then click Next.

How do I create a virtual directory in Visual Studio 2015?

Select your site under IIS Express Sites and click Open. Click Web Site menu and New Virtual Directory... Give Alias Name and Folder path and click OK.

Where does IIS Express create virtual directory?

To create a Virtual Directory in IIS Express simple navigate to the IIS Express' config directory located in _C:\Users<User>\Documents\IISExpress\config_ and open the applicationhost. config file.


3 Answers

You have to check the URL you are trying to deploy matches a binding in your local IIS.

For example if you are deploying to http://localMachineName/yourapp you should have a WebSite on IIS that has the binding created to

  • Hostname:LOCALMACHINE or *
  • PORT:80(in this case)

The most common case is that you use localhost as server name, so check you have the binding:

  • Hostname: localhost or *
  • PORT:80(in this case)

In other words, Visual studio connects to your IIS looking for a binding that should exist.

Also check you execute VS as administrator.

like image 101
X.Otano Avatar answered Oct 23 '22 19:10

X.Otano


You need to create a Website binded 80 port.

  1. Open IIS manager
  2. Right click sites, add website
  3. Site Name: Website Pyhsical path: C:\inetpub\wwwroot Host Name: Leave blank IP address: All Unassigned Port: 80
  4. Open VS as administrator
  5. Go to your project properties > web > server > local iis
  6. And now click create virtual directory. It's will be work :)

We have created firstly main Website on iis and we created sub website on visual studio has bind it to main Website.

like image 5
c3h4n Avatar answered Oct 23 '22 21:10

c3h4n


Delete this file in your root project folder (or back it up)

.vs\config\applicationhost.config 

Empty the IISUrl tags in your project file (if there is one)

<IISUrl></IISUrl>

Go to project properties and try to create your virtual url again.

like image 1
Jeremy A. West Avatar answered Oct 23 '22 19:10

Jeremy A. West