WIX : Create virtual directory under other website than 'Default Web Site' - iis

I have created an installer where user has option to select a website from dropdown (dropdown will list all available websites) and provide name for virtual directory.
Code:
<iis:WebVirtualDir Id="PCVDir" Alias="[VDNAME]" Directory="dir_MDMCenter_0" WebSite="MySelectedWebSite">
<iis:WebApplication Id="PCWebApp" Name="[VDNAME]" WebAppPool="MyAppPool" />
</iis:WebVirtualDir>
<iis:WebAppPool Id="MyAppPool" Name="[APPPOOLNAME]" ManagedRuntimeVersion="v4.0" ManagedPipelineMode="integrated" Identity="localSystem" IdleTimeout="0" RecycleMinutes="0">
</iis:WebAppPool>
<iis:WebSite Id="MySelectedWebSite" Description="[MYWEB_WEBSITE_DESCRIPTION]">
<iis:WebAddress Id="AllUnassigned1" Port="[MYWEB_WEBSITE_PORT]" IP="[MYWEB_WEBSITE_IP]" Header="[MYWEB_WEBSITE_HEADER]" />
</iis:WebSite>
When user installs and selects website other than 'Default web site', virtual directory always gets created in 'Default Web Site'.
Analysis:
New website I create runs on port 80. I have stopped Default Web Site as it also runs on port 80.
Now when we install in other website, virtual directory goes under Default Web Site. Seems somewhere in WIX or IIS has binding saying port 80 is mapped to Default Web Site.
In log, I verified values of all the variables (MYWEB_WEBSITE_DESCRIPTION, MYWEB_WEBSITE_PORT) are coming correct. But still application goes under Default Web site.
Can someone please correct me if am doing something wrong.

It seems like you have to create custom actions to populate the drop down box with websites and to install under different website. Please try referring to
http://blog.torresdal.net/2008/10/24/WiXAndDTFUsingACustomActionToListAvailableWebSitesOnIIS.aspx

Related

page is not displaying, php project on iis

I have done all IIS and PHP manager configuration
and created one website called website1 and I set the ip address and name website1.net in host file, when I click browse in IIS the result is page cant be displayed. any solutions ?

How to forward to Lightswitch html client from domain root deployed on Azure Websites

I have successfully deployed a Lightswitch HTML application to Azure Websites. I have also forwarded my personal domain to mask the azurewebsite.net address. I am now able to access the site by typing mydomain.com/htmlclient and everything works fine. If I type in just the my domain.com, however, I get the you do not have permission error.
This is close but ultimately I would like to be able to enter just the domain and have it automatically forward to the htmlclient folder. I know it is possible but I'm not sure if I can get there with settings in azure or my domain host or if I have to drop a page in the root (it appears that the default and login.aspx pages for forms authentication are already in the root).
Any help would be appreciated.
In the Visual Studio 2013 version we've found this is simply a case of adding an additional entry to the LightSwitch server project's web.config file.
This additional entry needs to reference the default.aspx file (which should already be part of the server project) and should be introduced into the defaultDocument section of the web.config. In the following example, this new line appears immediately after the standard default.htm line: -
<defaultDocument>
<files>
<clear />
<add value="default.htm" />
<add value="default.aspx" />
</files>
</defaultDocument>

Is it possible to bind two ports to a website using Wix and IIS7?

The Wix code is as follows:
<iis:WebSite Id="TheWebSite" Description="My web Site" Directory="IISWEBROOT">
<iis:WebAddress Id="MyWebSiteAllUnassigned" Port="80" />
<iis:WebAddress Id="MyWebSiteAllUnassignedSSL" Port="443" Secure="yes" />
However during install the Windows Process Activation Service crashes and the first port is not set. It's not clear exactly what point during the install the service crashes. Is it possible to set two ports like this?
(The Default Web Site has had it's ports changed to something other than 80 and 443.)
The answer is yes. One of our other custom actions was incorrectly clearing the bindings before the end of installation.

Wix + IIS : Creating a virtual directory on a web site with bindings for port 80 disabled

I have a Wix installed which creates a virtual directory in IIS via the following:
<DirectoryRef Id="INSTALLLOCATION">
<Component Id="VirtualDirectory" Guid="29BEECCC-AA5F-11DF-BBB1-9C0AE0D72085">
<iis:WebVirtualDir Id="MyVDir" Directory="INSTALLLOCATION" Alias="MyVDir" WebSite="DefaultWebSite">
<iis:WebApplication Id="MyApplication" Name="MyVDir" />
</iis:WebVirtualDir>
<CreateFolder />
</Component>
</DirectoryRef>
<iis:WebSite Id="DefaultWebSite" Description="Default Web Site">
<iis:WebAddress Id="AllUnassigned" Port="80" />
</iis:WebSite>
However this fails if the bindings for port 80 have been removed for that web site.
The <iis:WebAddress /> element and Port attributes are both mandatory, however completely superfluous in this case - I don't care what the Port of the web site is, as long as it creates my virtual directory!
Is there any way of getting the above installer to successfully create a virtual directory without prompting the user for a port number?
All virtual directories are rooted in a web site. The WebSite element can be used to create a web site if WebSite element is under Component element or used to find a web site if not. The VirtualDir element must refer to a WebSite element somehow. That's the design of IIS thus the WiX models this way.
Note: One might argue that WebSite element not under a Component element should have been named "WebSiteSearch" or something.
I've found that as long as the SiteId attribute is provided the port is in fact ignored. The solution to my problem was to therefore change my WebSite element to be:
<iis:WebSite Id="DefaultWebSite" Description="Default Web Site" SiteId="*">
<iis:WebAddress Id="AllUnassigned" Port="1" />
</iis:WebSite>
Note that the Port attribute is still required (and cannot be 0), however is ignored even if the SiteId attribute is * (meaning that the description is used to identify the site).
See WebSite Element (WiX documentation) for more information.

IIS7 startup site

I have a Windows 2008 Server with IIS7 on it and a web page running under the name, let's say myApplication. I have a domain name that points to the IP of my server, let's say myApplication.com.
In order to access my application I have to enter http://myApplication.com/myApplication.
If I write http://myApplication.com/ I arrive to the IIS7 start page. Is there a way (besides rewriting the iisstart.htm to make a JavaScript or meta-data redirect) to automatically open the myApplication when someone enters "http://myApplication.com/"?
What I would like is the following:
The user enters in the browser: "http://myApplication.com/"
He/she is taken to "http://myApplication.com/myApplication"
In the URL bar of the browser only "http://myApplication.com/" shows and everything inside the application is relative to this URL.
Generally when I configure IIS, I set the properties for the "default web site" to a folder that doesn't contain anything, then create individual entries within IIS for each web site. For example, you would create a new entry for "MyApplication.com" and set its home directory to the proper folder on the server that contains your root files (usually c:\inetpub\wwwroot\myapplication.com\ but it could be anywhere you like).
It sounds as if you have created a folder for your application, but do not have a specific entry in IIS configured to handle the requests and load files from the proper folder.
If you have a dedicated IP address for the application, be sure to specify that IP within the site settings for that site. If you're using a single IP for multiple sites, configure the IP AND hostnames/domains that will be used to access that site so IIS will know which site entries belong to which domains and where to route the requests.

Resources