在浏览器中运行 WPF 应用程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17261858/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 23:51:17  来源:igfitidea点击:

Run WPF application in browser

wpfbrowserxbap

提问by Koscik

I have my application wrote in WPF. Now, i want it to run in browser so I've read about it and I know that XBAP is my solution.

我的应用程序是用 WPF 编写的。现在,我希望它在浏览器中运行,所以我已经阅读了它并且我知道 XBAP 是我的解决方案。

What is my problem? It won't run on my PC. I checked every popular browser (chrome, FF, IE, opera) and nothing. Browsers can't handle .xbapfiles and just downloads it. I try and try and nothing but above happened. Can anyone guess why it don't work? Is it deprecated technology, i have too-new browsers or what? Every entries I found about it are 2-4 years old.

我的问题是什么?它不会在我的电脑上运行。我检查了所有流行的浏览器(chrome、FF、IE、opera),但一无所获。浏览器无法处理.xbap文件,只能下载。我尝试并尝试,但没有发生以上情况。谁能猜到为什么它不起作用?是过时的技术,我的浏览器太新还是什么?我发现的每个条目都是 2-4 岁。

回答by Colin Smith

Firstly for Internet Explorer (IE9 onwards) you need to ensure that you have enabled XBAP/XAML support:

首先对于 Internet Explorer(IE9 以上),您需要确保已启用 XBAP/XAML 支持:

enter image description here

在此处输入图片说明

For Firefox and Chrome you have to do something a bit different:

对于 Firefox 和 Chrome,您必须做一些不同的事情:

But in addition to the above you need to be aware that when you run an XBAP application it runs in the Internet Zone....so your biggest problem is that normally you don't have full-trust...therefore your application can't call privileged code...if it tries to then you get security exceptions.

但是除了上述之外,您还需要注意,当您运行 XBAP 应用程序时,它会在 Internet 区域中运行....所以您最大的问题是通常您没有完全信任...因此您的应用程序可以不要调用特权代码……如果它尝试调用,则会出现安全异常。

One way to get your XBAP to be "trusted" is to get it signed with a certificate (you should purchase a proper one from Verisign rather than use a test certificate) and deployed with ClickOnce.

使您的 XBAP 获得“信任”的一种方法是使用证书对其进行签名(您应该从 Verisign 购买适当的证书,而不是使用测试证书)并使用 ClickOnce 进行部署。

Or you can keep your application as a regular WPF .EXE and use ClickOnce to deploy it from a website but run it locally with full trust.

或者您可以将您的应用程序保留为常规 WPF .EXE 并使用 ClickOnce 从网站部署它,但在完全信任的情况下在本地运行它。

回答by MineScript

not straight forward way, you can find you answer Microsoft MSDN Forum

不是直截了当的方式,你可以找你回答微软MSDN论坛