UWP app installation fails through UI, works in PowerShell

1

I'm attempting to distribute a UWP application, and have hit a slightly odd issue.

  • The application is built from Visual Studio using the automatic update feature, resulting in a .appinstaller file and associated MSIX bundles etc
  • These artefacts are uploaded to an Azure App Service for distribution
  • Downloading and running the .appinstaller file gives the error Error in parsing the app package. - not particularly helpful
  • The app is signed with a certificate that is installed under Trusted Publishers
  • The web.config file on the server is set up to map MIME types correctly:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.webServer>
    <staticContent>
      <mimeMap fileExtension=".appx" mimeType="application/appx" />
      <mimeMap fileExtension=".msix" mimeType="application/msix" />
      <mimeMap fileExtension=".appxbundle" mimeType="application/appxbundle" />
      <mimeMap fileExtension=".msixbundle" mimeType="application/msixbundle" />
      <mimeMap fileExtension=".appinstaller" mimeType="application/appinstaller" />
    </staticContent>
  </system.webServer>
</configuration>
  • Running the installation from PowerShell (un-elevated) using Add-AppxPackage -Appinstaller https://[test].azurewebsites.net/[appname].appinstaller correctly installs the app, which then works fine.

  • Using Fiddler, I've observed that installing via the UI results in a 412 error from the server:

Request:

GET https://[test].azurewebsites.net/[appname]_1.0.0.0_Test/[appname]_1.0.0.0_x64.msixbundle HTTP/1.1
Connection: Keep-Alive
Accept-Encoding: gzip, deflate
If-Match: W/"086c9a4cfd51:0"
Range: bytes=10878976-11010047
If-Unmodified-Since: Mon, 20 May 2019 20:42:56 GMT
Host:[test].azurewebsites.net

Response:

HTTP/1.1 412 Precondition Failed
Content-Length: 86
Content-Type: text/html
Last-Modified: Mon, 20 May 2019 20:42:56 GMT
Accept-Ranges: bytes
ETag: W/"086c9a4cfd51:0"
Server: Microsoft-IIS/10.0
X-Powered-By: ASP.NET
Date: Mon, 20 May 2019 20:21:12 GMT

The request was not completed due to preconditions that are set in the request header.
  • The PowerShell client does not appear to send the If-Unmodified-Since or If-Match headers.
GET https://[test].azurewebsites.net/[appname]_1.0.0.0_Test/[appname]_1.0.0.0_x64.msixbundle HTTP/1.1
Connection: Keep-Alive
Range: bytes=11079260-11145819
User-Agent: App Virt Client/1.0
Host: [test].azurewebsites.net

Given the above:

  • Am I missing any obvious server configuration for hosting a UWP .appinstaller under IIS?
  • Is there any known issue sideloading UWP applications via the .appinstaller UI?
  • Is there a way to configure IIS to ignore the preconditions, as a test of whether these are causing the issue?

EDIT:

Found a log file (AILog.txt):

[Tue May 21 15:40:17 2019]{10188} Manifest Info -> Package is Not Headless
[Tue May 21 15:40:17 2019]{10188} Manifest Info -> Package is Not a Modification Package
[Tue May 21 15:40:17 2019]{10188} ERROR: AppsInfo -> Error: [0x80004005]

EDIT 2:

After much investigation, I've got a working build with comparatively few changes:

  • EnableDotNetNativeCompatibleProfile (I set this to true)
  • RuntimeIdentifiers (I added these into the .csproj file)
  • Build from VS2017 instead of VS2019

Hopefully a process of elimination will identify which of these is the culprit.

windows
windows-10
iis
azure
uwp
asked on Super User May 20, 2019 by Ben Owen • edited May 21, 2019 by Ben Owen

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0