6

I want to set the application pool for a website that I'm installing, but there is no virtual directory or web application. The website is contained directly in the website entry in IIS and I want wix to set the application pool for that website.

Is this possible?

user145400
  • 1,076
  • 1
  • 12
  • 27

2 Answers2

9

Have you looked that the WebAppPool Element?

This article 'creating a web application installer ...' may provide you with some useful info e.g.

<!-- Define App Pool - identity if not set defaults to: ApplicationPoolIdentity -->
<iis:WebAppPool Id="AppPool" Name="[VD][WEBSITE_ID]" ManagedRuntimeVersion="v4.0" 
                IdleTimeout="0" RecycleMinutes="0" ManagedPipelineMode="integrated">
</iis:WebAppPool>

<iis:WebVirtualDir Id="VDir" Alias="[VD]" 
                   Directory="INSTALLLOCATION"
                   WebSite="SelectedWebSite">
  <iis:MimeMap Id="SilverlightMimeType" Extension=".xap" 
               Type="application/x-silverlight-app" />
  <iis:WebApplication Id="MyWebAppApplication" WebAppPool="AppPool" 
                      Name="[VD][WEBSITE_ID]" />
  <iis:WebDirProperties Id="MyWebSite_Properties" AnonymousAccess="yes" 
                        WindowsAuthentication="no" DefaultDocuments="Default.aspx" />
</iis:WebVirtualDir>

to connect them the iis:WebApplication/@WebAppPool entry is used to reference the AppPool iis:WebAppPool/@Id

One other suggestion is to update the WebApplication of the WebSite like this e.g.

<Component Id="WebSite" Guid="PUT-YOUR-GUID-HERE">
    <CreateFolder/>
    <iis:WebSite Id="WebSite" Directory="WebSiteRoot" Description="[WEBSITEDESCRIPTION]" >
        <iis:WebApplication Id="WebSiteApplication" Name="[WEBSITEDESCRIPTION]" WebAppPool="MyAppPool" />
    </iis:WebSite>
    <iis:WebAppPool Id="MyAppPool" Name="[APPPOOLNAME]" ManagedRuntimeVersion="v4.0"/>
</Component>
Shaun Wilde
  • 8,228
  • 4
  • 36
  • 56
  • I also found a similar question http://stackoverflow.com/questions/6028848/setting-the-apppool-of-a-website-element-in-wix-3-6 which may help – Shaun Wilde Oct 22 '14 at 22:46
  • 3
    I've seen that question actually, and it comes to the conclusion that wix has an odd limitation: it can't set the app pool for the website, but it can do it for a virtual directory. I asked again because I thought maybe it has been fixed in a newer version. Having said that, that is why your answer doesn't actually answer my question :) – user145400 Oct 22 '14 at 22:54
  • Perhaps but you haven't described what you've tried so far so I didn't know you knew about that Wix Element – Shaun Wilde Oct 22 '14 at 23:01
  • What about the updated approach regarding the WebApplication within the WebSite? – Shaun Wilde Oct 23 '14 at 01:47
  • Well after further testing, my conclusion from yesterday was invalid. It does work with your edit (that's actually what I was trying but in my case I didn't uninstall the website entry, meaning the first website installed with the wrong app pool was staying there the whole time through all my installs/uninstalls...) – user145400 Oct 23 '14 at 16:10
4

@user145400 said:

I've seen that question actually, and it comes to the conclusion that wix has an odd limitation: it can't set the app pool for the website, but it can do it for a virtual directory. I asked again because I thought maybe it has been fixed in a newer version. Having said that, that is why your answer doesn't actually answer my question

Yes you can set pool for WebSite element, do it like that:

<iis:WebAppPool Id="MyWebSite_AppPool"
                Name="[POOLNAME]"
                Identity="networkService"
                ManagedRuntimeVersion="v4.0"
                ManagedPipelineMode="integrated"/>
            <!--define web site-->
<iis:WebSite Id="MyWebSite_Website"
             Description="[WEBSITENAME]"
             AutoStart="yes"
             StartOnInstall="yes"
             ConfigureIfExists="yes"
             Directory="INSTALLDIR">

     <iis:WebApplication Id="MY_WebApp"
                         Name="MY Web Site"
                         WebAppPool="MyWebSite_AppPool"
                         ScriptTimeout="360" />
</iis:WebSite>

As you can see using iis:WebApplication element in iis:WebSite element with attribute WebAppPool its possible :)

Buzka91
  • 399
  • 1
  • 14