Click here to Skip to main content
15,885,912 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I need to place our WebSite under Site in IIS using WIX.
(I use a WIX Setup-Project in VS2022 -> I create a msi-file.)

Like so:

SomeServer
|->Application Pool
|->Sites
..|->Default Web Site
..|->My New Web Site <- this is what I want.
A new website under Sites, not under the Default Web Site.

What I have tried:

I followed this great article:
https://www.codeproject.com/Articles/115036/Creating-WIX-Installer-for-ASP-NET-Web-Application

I think the important part in the article is:
XML
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:iis="http://schemas.microsoft.com/wix/IIsExtension"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
    
    <Fragment>
        <?include ConfigurationInitialize.wxi ?>

        <!-- Install to default web site -->
        <iis:WebSite Id="DefaultWebSite" Description='Default Web Site'>
            <iis:WebAddress Id="AllUnassigned" Port="80" />
        </iis:WebSite>

        <DirectoryRef Id="MYWEBWEBSITE">
            <!-- Configuring app pool -->
            <Component Id="MyWebAppPoolCmp" Guid="" KeyPath="yes">
                <util:User Id="MyWebAppPoolUser"
                           CreateUser="no"
                           Name="[WEB_APP_POOL_IDENTITY_NAME]"
                           Password="[WEB_APP_POOL_IDENTITY_PWD]"
                           Domain="[WEB_APP_POOL_IDENTITY_DOMAIN]" />
                <iis:WebAppPool Id="MyWebAppPool"
                                Name="[WEB_APP_NAME]"
                                Identity="other"
                                User="MyWebAppPoolUser" />
            </Component>
        
            <!-- Configure virtual dir -->
            <Component Id="MyWebVirtualDirCmp" 
                   Guid="{751DEB01-ECC1-48ff-869A-65BCEE9E0528}" 
                   KeyPath="yes" >
                <iis:WebVirtualDir Id="MyWebVirtualDir" 
                          Alias="[VIRTUAL_DIR_VAL]" Directory="MYWEBWEBSITE" 
                          WebSite="DefaultWebSite">
                    <iis:WebDirProperties Id="MyWebVirtDirProperties" 
                       AnonymousAccess="no" BasicAuthentication="no" 
                       WindowsAuthentication="yes" />
                    <iis:WebApplication Id="MyWebWebApplication" 
                       Name="[VIRTUAL_DIR_VAL]" />
                </iis:WebVirtualDir>
            </Component>
        </DirectoryRef>

        <ComponentGroup Id="MyWebIssConfiguration">
            <ComponentRef Id="MyWebVirtualDirCmp" />
            <ComponentRef Id="MyWebAppPoolCmp" />
        </ComponentGroup>
        
    </Fragment>
</Wix>


But that puts the new WebSite under the Default Web Site:

SomeServer(xxx\myName)
|->Application Pool
|->Sites
..|->Default Web Site
....|->My New Web Site <- this is not what I want.
New Web Site is under the Default Web Site
Posted
Updated 24-Nov-21 1:45am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900