使用.NET 4.5在IE中加载.NET UserControls

人气:955 发布:2022-09-21 标签: internet-explorer user-controls .net-4.5

问题描述

有一个类似的问题:加载.NET UserControls in使用.NET 4.0的IE 这个问题基本相同,但对于 .NET 4.5

There is a similar question: Loading .NET UserControls in IE with .NET 4.0 This question is essentially the same, but for .NET 4.5

该问题的开头是: 我有一个遗留应用程序,其中有一个UserControl,用作IE中加载的网页中的activex。在.NET 4.0之前,有安全策略和MMC控制台用于创建代码组等。看起来这一切都已经用于.NET 4.0。

安装.NET 4.5后,似乎解决方法不再有效,并且IE无法加载任何用户控件。我担心这个功能会被彻底删除。在这种情况下,我们在用户可以安装.NET 4.5之前要做一些严肃的重写。

After installing .NET 4.5 it seems the workaround is no longer working, and that IE is unable to load any usercontrol. My fear is that this feature is removed altogether. In that case we have some serious rewriting to do before our users can install .NET 4.5

一些注意事项: 一切正常完全适用于.NET 4.5 RC。 8 - ( Fuslogvw(程序集绑定日志查看器)在升级之前按预期运行,但在升级之后它没有记录任何内容。(并且没有加载usercontrol。) 在生产中,controll必须以完全信任的方式运行,但我所有的测试都是通过一个不需要这个的简单控件完成的。

Some notes: Everything was working perfectly fine with the .NET 4.5 RC. 8-( Fuslogvw (Assembly Binding Log Viewer) Behaves as expected before upgrade, but after upgrade it is not logging anything. (And usercontrol is not being loaded.) In production the controll will have to run with full trust, but all my testing has been done with a simple control that does not require this

有任何关于此功能的消息或信息吗?

Anybody who has sugestions or information regarding this feature?

谢谢

推荐答案

这在MSDN上的.NET 4.5应用程序兼容性页面中有记录: http://msdn.microsoft.com/en-us/library/hh367887.aspx 。开箱即用的托管控件不再支持开箱即用(请参阅中途停止)在Web应用程序下:

This is documented in the .NET 4.5 Application Compatibility Page on MSDN: http://msdn.microsoft.com/en-us/library/hh367887.aspx . Hosting managed controls inside IE is no longer supported out of the box (see half-way down under "Web Applications"):

功能:来自.NET Framework 1.1和2.0的托管浏览器托管控件

Feature: Managed browser hosting controls from the .NET Framework 1.1 and 2.0

更改: 在Internet Explorer中阻止托管这些控件。

Change: Hosting these controls is blocked in Internet Explorer.

影响: Internet Explorer无法启动使用托管浏览器托管控件的应用程序。通过将注册表子项HKLM / SOFTWARE / MICROSOFT / .NETFramework的EnableLegacyIEHosting值设置为1,可以恢复先前的行为。

Impact: Internet Explorer will fail to launch an application that uses managed browser hosting controls. The previous behavior can be restored by setting the EnableLegacyIEHosting value of the registry subkey HKLM/SOFTWARE/MICROSOFT/.NETFramework to 1.

不幸的是,注册表项上的信息似乎不完整和错误:

Unfortunately, the information on the registry key appears to be incomplete and wrong:

该设置实际上称为EnableIEHosting。

The setting is actually called "EnableIEHosting".

它必须位于HKCU Hive:HKCU \ SOFTWARE \ Microsoft \ NETFramework

It must be located either in the HKCU Hive: HKCU\SOFTWARE\Microsoft\.NETFramework

32位系统:HKLM \ SOFTWARE \\ \\ MICROSOFT \.NETFramework 64位系统:HKLM \ SOFTWARE \Wow6432Node\Microsoft\.NETFramework

这是在Windows Server 2008R2和Windows 8上测试的。

This was tested on both Windows Server 2008R2 and Windows 8.

127