托管的UWP应用上的渐进式Web应用不适用于HTTPS(自签名) [英] Progressive Web App on a hosted UWP app does not work with HTTPS (Self-Signed)

查看:92
本文介绍了托管的UWP应用上的渐进式Web应用不适用于HTTPS(自签名)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

IIS上托管的PWA Angular应用程序(带有自签名证书的HTTPS绑定)正由UWP应用程序(托管的UWP:只是指向PWA应用程序的UWP Shell)访问.

A PWA Angular App hosted on IIS (HTTPS binding with Self-Signed cert) which is being accessed by an UWP app (Hosted UWP: just a UWP shell pointing to the PWA App).

package.appxmanifest 配置(例如StartPage和Content URI)指向具有HTTP方案的PWA时,它运行良好(当然,由于需要HTTPS,因此Service Worker注册会抛出错误) ).但是,当我更新URL以指向HTTPS时,UWP仅显示空白屏幕且没有错误(在调试UWP时,在VS2017的Javascript控制台上).

When the package.appxmanifest configurations such as StartPage and Content URIs are pointing to the PWA with HTTP scheme it works well (Except of course the Service Worker registration throws a an error since HTTPS is a requirement). However, when I update the URLs to point to HTTPS the UWP shows only a blank white screen with no errors (on the Javascript Console of VS2017 while debugging the UWP).

注意:使用HTTPS访问PWA可以从浏览器正常工作.仅供参考,使用自签名证书.

NOTE: Accessing the PWA using HTTPS works fine from the browser. FYI, using a self-signed certificate.

简而言之:
PWA + BROWSER +(HTTP或HTTPS)=>确定
PWA + UWP + HTTP =>确定
PWA + UWP + HTTPS(自签名)=> NG

In short:
PWA+BROWSER+(HTTP OR HTTPS) => OK
PWA+UWP+HTTP => OK
PWA+UWP+HTTPS (Self-Signed) => NG

推荐答案

开发PWA-UWP时的常见约束:

Common constraints while developing PWA-UWP:

  • Windows 10最低版本:1809(自EdgeHTML WebView开始支持Service Worker)
  • 在客户端设备上安装SSL证书(如果是自签名的话)
  • 应用程序URL必须以:https://<DomainName>(IP地址不起作用)开头
  • 客户端设备必须启用开发者模式(必须允许侧面加载的应用程序)
  • Min Windows 10 Version: 1809 (Service Worker supported since for EdgeHTML WebView)
  • Install SSL certificate on client devices (In case of self signed)
  • App URL must start with: https://<DomainName> (IP address does not work)
  • Client devices must have Developer Mode enabled (must allow Sideloaded apps)

警告: 如果您正在计划以下Visual Studio模板来创建UWP-PWA: 请注意,在构建应用程序时,应在pa​​ckage.appxmanifest中知道并配置应用程序URL.对于我们而言,这是不可能的,因为我们正在构建本地PWA.

WARNING: If you are planning the following Visual Studio template to create UWP - PWA: Note that Application URL should be known and configured in package.appxmanifest at the time of building the application. In our case this was not possible since we were building an On-Premise PWA.

但是,如果应用程序URL是固定的,则可以使用WinJs API的全部功能.最好的部分是WinJs API访问代码可以在您的PWA中编写,因此您的UWP项目只是一个包含0个代码的shell.

However, In case the App URL is fixed then you can use the full power of WinJs APIs. The best part about that is the WinJs API access code can be written in your PWA, hence your UWP project is just a shell with 0 code.

这篇关于托管的UWP应用上的渐进式Web应用不适用于HTTPS(自签名)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆