Katherine Ha
Katherine Ha

Reputation: 1

MVC Web Application Deployment - Create an MSI using Wix

our team is at delivery state for an MVC Web Application - ASP.NET with Wix toolset V3.11 and Wix Extension (Votive) for VS2019. The requirement is that the clients will only need to install the website on their side using .msi provided by us and are able to browse from their IIS Manager.

I'm struggling to configure IIS properly (with port, IP, etc...) within Product.wxs.

After installing from .msi created by Wix setup project, a website is created in IIS Manager, but when I browse the site, the page shows "Access is denied". Given that I'd assigned all permissions to "IUSR" as suggested by others.

In addition, our website pages also support windows authentication and authorization, how could I specify that in Product.wxs?

I am a newbies in Windows, Wix installer universe.

EDIT: After I uninstall and reinstall, give permission for "IUSR" to the folder, verify that ApplicationPool is correct, browse the web and "HTTP Error 503: Service is unavailable" occurs.

What am I missing?

<Component Id="IISConfigure" Guid="[GUID]" KeyPath="yes" Directory="INSTALLFOLDER">
  <util:User Id="MyWebsite_AppPoolUser" Name="domainusername" Password="pwd"/>

  <!--define application pool-->
  <iis:WebAppPool Id="MyWebsite_AppPool" Name="MyWebsiteApplication"
                  Identity="other" User="MyWebsite_AppPoolUser"
                  RecycleMinutes="120" />

  <!--define web site-->
  <iis:WebSite Id="MyWebsite_Website" Description="[Descript]"
               AutoStart="yes" StartOnInstall="yes" ConfigureIfExists="yes"
               Directory="INSTALLFOLDER" ConnectionTimeout="360" >

    <iis:WebAddress Id="AllUnassigned" IP="*" Port="81" />
    <iis:WebApplication Id="MyWebsite_WebApp" Name="MyWebsite" WebAppPool="MyWebsite_AppPool"
                        ScriptTimeout="360" />
    <iis:WebDirProperties Id="MyWebsite_Properties" AnonymousAccess="yes" WindowsAuthentication="no"
           DefaultDocuments="[path]\Index.cshtml" />
  </iis:WebSite>
</Component>

Upvotes: 0

Views: 370

Answers (1)

Vivek
Vivek

Reputation: 1079

For setting windows authentication, you need to write a custom action:

    <CustomAction Id="SetWindowsAuthentication"
              Execute="deferred"
              Impersonate="no"
              Return="check"
              Directory="TARGETDIR"
              ExeCommand="appcmd.exe set config "MyWebsite" -section:system.webServer/security/authentication/windowsAuthentication /enabled:"True" /commit:apphost" />

<InstallExecuteSequence>
    <Custom Action="SetWindowsAuthentication" Before="InstallFinalize"><![CDATA[NOT Installed]]></Custom>
</InstallExecuteSequence>

This custom action should be deferred and must be executed between InstallInitialize and InstallFinalize.

Upvotes: 0

Related Questions