Windows 10中缺少API,用于在同一台计算机上的UWP应用程序和Edge扩展之间进行通信 [英] Missing APIs in Windows 10 for communication between UWP app and Edge extension on same machine

查看:66
本文介绍了Windows 10中缺少API,用于在同一台计算机上的UWP应用程序和Edge扩展之间进行通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 
$


我开发了一个Edge扩展,需要与安装在同一台机器上的UWP(由我自己开发)进行通信。但似乎没有办法实现这一目标。



我尝试了以下方法,但两者都是徒劳的。



方法1:通过环回的Web套接字

============================= ============

我在UWP App中运行服务器,监听本地端口,我的Edge扩展充当客户端,从UWP App请求数据。



观察:失败。对UWP应用程序的Microsoft沙箱限制不允许在localhost上进行TCP通信。由于Edge和我的应用都是沙盒UWP应用,因此这种方法失败。 
$


哈克:我可以通过禁用两个边缘的网络隔离来使其工作通过以下命令作为管理员使用UWP应用程序。

CheckNetIsolation.exe LoopbackExempt -a -n =" Microsoft.MicrosoftEdge_8wekyb3d8bbwe"

CheckNetIsolation.exe LoopbackExempt -a -n =" ;我的应用程序"



它在开发机器上没问题,但你不能向你的客户推荐这个。



备注:至少应允许同一发布者在扩展程序和UWP应用程序之间进行TCP通信,因为两者都可以从Store获得并由Microsoft认证。我认为没有任何安全风险。



方法2:使用申请服务

======== ==============================

Microsoft为两个UWP应用程序之间的通信提供了App服务API我们也为了我们的目标尝试了它们。



观察:失败。 Edge扩展无法访问App Service命名空间。因此,尽管是一个UWP应用程序,Edge无法与本地App服务进行通信(或限制其扩展)。此处提出了一项功能请求:

https://wpdev.uservoice.com/forums/257854-microsoft-edge-developer/suggestions/15206358-calling-consuming-an-app-service-from -edge-extensi

Hi, 

I have developed a Edge extension that need to communicate to an UWP (developed by myself) installed on same machine. But there seems no way to do achieve this.

I have tried following methods but both they were in vain.

Method 1: Through Web-sockets on loopback
=========================================
I ran a server in UWP App, listening on local port and my Edge extension act as a client to request data from UWP App.

Observation: Failed. Microsoft sandbox restrictions on UWP apps do not allow TCP communication on localhost. As both Edge and my app, are sandboxed UWP apps, hence this method fails. 

Hack: I can make it work by disabling net-isolation of both Edge and UWP app by following command as admin.
CheckNetIsolation.exe LoopbackExempt -a -n="Microsoft.MicrosoftEdge_8wekyb3d8bbwe"
CheckNetIsolation.exe LoopbackExempt -a -n="my app"

Its ok on development machine but you can not recommend this to your customers.

Remarks: At least TCP communication between extension and UWP app by the same publisher should be allowed as both will be available from Store and certified by Microsoft. I don't see any security risk in it.

Method 2: By using Application Service
======================================
Microsoft has provided App services APIs for communication between two UWP Apps and we have also tried them for our objective.

Observation: Failed. Edge extension has no access to App Service namespace. So, despite being an UWP app, Edge can't communicate (or restricting its extensions) with local App service. A feature request is raised here:
https://wpdev.uservoice.com/forums/257854-microsoft-edge-developer/suggestions/15206358-calling-consuming-an-app-service-from-edge-extensi

备注:Microsoft并不是唯一支持Sandboxed环境的操作系统,不应该采用这种禁止所有通信安全的方法,因为它对我们这样的开发人员来说是非常有毒的。 
$


请帮我解决这个问题。

Remarks: Microsoft is not the only OS supporting the Sandboxed environment and shouldn’t practice this approach of barring all communication for security as it is very toxic for its developers like us. 

Please help me resolving this problem.

推荐答案

您可以在https://wpdev.uservoice.com/forums/257854-microsoft-edge-developer/category/87962-extensions发布有关Edge Extensions的建议和请求

You can post suggestions and requests for Edge Extensions at https://wpdev.uservoice.com/forums/257854-microsoft-edge-developer/category/87962-extensions

另外看看 
扩展API路线图

Also take a look at the  Extension API roadmap

有关编写Edge Extensions的讨论,请参阅https://developer.microsoft.com/en-us/microsoft -edge / community / support /

For discussion of writing Edge Extensions see https://developer.microsoft.com/en-us/microsoft-edge/community/support/


这篇关于Windows 10中缺少API,用于在同一台计算机上的UWP应用程序和Edge扩展之间进行通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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