Home > Software design >  MVC Web Application Deployment - Create an MSI using Wix
MVC Web Application Deployment - Create an MSI using Wix

Time:09-10

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>

CodePudding user response:

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.

CodePudding user response:

I have a FOSS tool that should help called IsWiX. See the website tutorial on this page.

https://github.com/iswix-llc/iswix-tutorials

Custom actions shouldn't be needed. I bake most of my defaults into the web.config and use WiX IIS Extension elements for the rest. Rarely do I need to call appcmd.exe.

I free one hour consultation is always available if you want me to walk you through it. I create web apps that use windows auth all the time so this is a very paved road.

  • Related