2009-06-22 73 views
1

我有一个包含用户控件的编译类库,我想将它添加到网页中。我在html页面中添加了一个对象标签,如下所示:添加用户控件到网页

<OBJECT id="Main" classid="http://localhost/HelloWorld/Hello.World.dll#Hello.World.UserControl"></OBJECT> 

但是,控件未显示。该DLL使它成为我的临时文件,并使网页上的对象框变为空白。我得到了我的Internet临时文件,看起来一个错误信息,如:?!

FusionBindError名= Hello.World.dll Hello.World.UserControl

我不知道如何调试这任何进一步。我想知道这是否是一个命名空间问题?

[编辑]

以下错误结束了在日志中:

Creating security manager 

Microsoft.IE.Manager: Microsoft.IE.Manager: unique id lgth = 42 
Microsoft.IE.SecureFactory: Create SecureFactory() with security information 
Microsoft.IE.Manager: Created secure factory 
Microsoft.IE.SecureFactory: Creating instance of the object in the correct domain 
Microsoft.IE.SecureFactory: pUrl = http://localhost/HelloWorld/ 
Microsoft.IE.SecureFactory: id = 86474707A31303E2234383E24333E2135330000000 
Microsoft.IE.SecureFactory: link = 
Microsoft.IE.SecureFactory: licenses = 
Microsoft.IE.SecureFactory: deployment manifest = 
Microsoft.IE.SecureFactory: Security options = ZoneEvidence, SiteEvidence 
Microsoft.IE.Manager: Url = http://localhost/HelloWorld/ 
Microsoft.IE.Manager: UrlGetPartW returned 0 
Microsoft.IE.Manager: UrlGetPartW returned 80070057 
Microsoft.IE.Manager: CodeBase = http://10.248.43.15 
Microsoft.IE.Manager: Application = HelloWorld 
Microsoft.IE.Manager: Found a codebase 
Microsoft.IE.Manager: UrlCanonicalize returned 0 
Microsoft.IE.SecureFactory: URL codeBase: http://localhost/ 
Microsoft.IE.SecureFactory: URL application: HelloWorld 
Microsoft.IE.SecureFactory: Locating domain for http://localhost/ 
Microsoft.IE.IDKey: Created key 
Microsoft.IE.Manager: The domain does not exist. 
Microsoft.IE.IDKey: Created key 
Microsoft.IE.Manager: The domain does not exist. 
Microsoft.IE.SecureFactory: Need to create domain 
Microsoft.IE.SecureFactory: Application base: http://localhost/ 
Microsoft.IE.SecureFactory: Private Bin Path: bin 
Microsoft.IE.IDKey: Created key 
Microsoft.IE.SecureFactory: Trying to create instance of type http://localhost/HelloWorld/Hello.World.dll#Hello.World.Main 
Microsoft.IE.SecureFactory: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'ComponentFactory.Krypton.Toolkit.KryptonManager' threw an exception. ---> System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.UIPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. 
    at System.Windows.Forms.ToolStripManager.set_Renderer(ToolStripRenderer value) 
    at ComponentFactory.Krypton.Toolkit.KryptonManager.b() 
    at ComponentFactory.Krypton.Toolkit.KryptonManager..cctor() 
The action that failed was: 
Demand 
The type of the first permission that failed was: 
System.Security.Permissions.UIPermission 
The first permission that failed was: 
<IPermission class="System.Security.Permissions.UIPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 
version="1" 
Window="AllWindows"/> 

The demand was for: 
<PermissionSet class="System.Security.PermissionSet" 
version="1"> 
<IPermission class="System.Security.Permissions.UIPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 
version="1" 
Window="AllWindows"/> 
</PermissionSet> 

The granted set of the failing assembly was: 
<PermissionSet class="System.Security.PermissionSet" 
version="1"> 
<IPermission class="System.Security.Permissions.FileDialogPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 
version="1" 
Access="Open"/> 
<IPermission class="System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 
version="1" 
Allowed="ApplicationIsolationByUser" 
UserQuota="512000"/> 
<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 
version="1" 
Flags="Execution"/> 
<IPermission class="System.Security.Permissions.UIPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 
version="1" 
Window="SafeTopLevelWindows" 
Clipboard="OwnClipboard"/> 
<IPermission class="System.Security.Permissions.SiteIdentityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 
version="1" 
Site="localhost"/> 
<IPermission class="System.Security.Permissions.UrlIdentityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 
version="1" 
Url="http://localhost/HelloWorld/Hello.World.dll"/> 
<IPermission class="System.Security.Permissions.ZoneIdentityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 
version="1" 
Zone="Internet"/> 
<IPermission class="System.Drawing.Printing.PrintingPermission, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
version="1" 
Level="SafePrinting"/> 
<IPermission class="System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 
version="1"> 
<ConnectAccess> 
<URI uri="(http|https)://localhost/*"/> 
</ConnectAccess> 
</IPermission> 
</PermissionSet> 

The assembly or AppDomain that failed was: 
Hello.World, Version=1.0.3460.18220, Culture=neutral, PublicKeyToken=null 
The method that caused the failure was: 
Void InitializeComponent() 
The Zone of the assembly that failed was: 
Internet 
The Url of the assembly that failed was: 
http://localhost/HelloWorld/Hello.World.dll 
    --- End of inner exception stack trace --- 
    at ComponentFactory.Krypton.Toolkit.KryptonManager.get_CurrentGlobalPalette() 
    at ComponentFactory.Krypton.Toolkit.VisualPanel..ctor() 
    at ComponentFactory.Krypton.Toolkit.KryptonPanel..ctor() 
    at Hello.World.BottomPanel.InitializeComponent() 
    at Hello.World.BottomPanel..ctor() 
    at Hello.World.Main.InitializeComponent() 
    at Hello.World.Main..ctor() 
    --- End of inner exception stack trace --- 
    at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) 
    at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) 
    at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) 
    at System.Activator.CreateInstance(Type type, Boolean nonPublic) 
    at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) 
    at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) 
    at System.Activator.CreateComInstanceFrom(String assemblyName, String typeName, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm) 
    at System.AppDomain.CreateComInstanceFrom(String assemblyFile, String typeName, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm) 
    at System.AppDomain.CreateComInstanceFrom(String assemblyFile, String typeName, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm) 
    at Microsoft.IE.SecureFactory.CreateInstanceWithSecurity2(Int32 dwFlags, Int32 dwZone, String wszSite, String wszId, String wszConfig, String wszLicenses, String wszDeploymentManifest) 
Microsoft.IE.SecureFactory: LOG exception 
Microsoft.IE.SecureFactory: Creating log entry ?FusionBindError!name=Hello.World.dll Hello.World.Main 
Microsoft.IE.SecureFactory: Logging to file C:\Documents and Settings\----\Local Settings\Temporary Internet Files\Content.IE5\F84FN98R\CAMF3O8J.HTM 

的IEHost错误日志文件(CAMF308J.HTM)包含:

***** IEHOST Error Log (Monday, 22 June 2009 12:00) ***** 



URL:  http://localhost/HelloWorld/Hello.World.dll 
Zone:  3 
Assembly Name: Hello.World.dll 
Type Name: Hello.World.Main 



----- Thrown Exception ----- 


System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'ComponentFactory.Krypton.Toolkit.KryptonManager' threw an exception. ---> System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.UIPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. 
    at System.Windows.Forms.ToolStripManager.set_Renderer(ToolStripRenderer value) 
    at ComponentFactory.Krypton.Toolkit.KryptonManager.b() 
    at ComponentFactory.Krypton.Toolkit.KryptonManager..cctor() 
The action that failed was: 
Demand 
The type of the first permission that failed was: 
System.Security.Permissions.UIPermission 
The first permission that failed was: 


The demand was for: 




The granted set of the failing assembly was: 
















The assembly or AppDomain that failed was: 
Hello.World, Version=1.0.3460.18220, Culture=neutral, PublicKeyToken=null 
The method that caused the failure was: 
Void InitializeComponent() 
The Zone of the assembly that failed was: 
Internet 
The Url of the assembly that failed was: 
http://localhost/HelloWorld/Hello.World.dll 
    --- End of inner exception stack trace --- 
    at ComponentFactory.Krypton.Toolkit.KryptonManager.get_CurrentGlobalPalette() 
    at ComponentFactory.Krypton.Toolkit.VisualPanel..ctor() 
    at ComponentFactory.Krypton.Toolkit.KryptonPanel..ctor() 
    at Hello.World.BottomPanel.InitializeComponent() 
    at Hello.World.BottomPanel..ctor() 
    at Hello.World.Main.InitializeComponent() 
    at Hello.World.Main..ctor() 
    --- End of inner exception stack trace --- 
    at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) 
    at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) 
    at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) 
    at System.Activator.CreateInstance(Type type, Boolean nonPublic) 
    at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) 
    at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) 
    at System.Activator.CreateComInstanceFrom(String assemblyName, String typeName, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm) 
    at System.AppDomain.CreateComInstanceFrom(String assemblyFile, String typeName, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm) 
    at System.AppDomain.CreateComInstanceFrom(String assemblyFile, String typeName, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm) 
    at Microsoft.IE.SecureFactory.CreateInstanceWithSecurity2(Int32 dwFlags, Int32 dwZone, String wszSite, String wszId, String wszConfig, String wszLicenses, String wszDeploymentManifest) 
+0

我还没有尝试创建像这样的用户控件。 .NET融合日志查看器在调试问题时是否有所帮助? – willem 2009-06-22 15:31:15

+0

我无法让Fusion Log查看器帮助我。但我在.NET HKLM中启用了IEHostLogFile设置。我能从那里获得输出。它看起来像我遇到与我继承的第三方DLL的权限错误。 – Daniel 2009-06-22 15:54:59

回答

1

在这个文件是堆栈跟踪 - 如果您发布它,我可能会提供帮助。此外,您需要完全信任在.NET x.x Configuration控制面板中设置的站点(或使用CASPOL进行设置)。

下面是如何调试

  1. 使用Fiddler(谷歌,下载和运行)。
  2. 刷新页面
  3. 控件是否已下载?你得到一个HTTP 500 - 如果是这样的话,请关闭IIS中目录中的“脚本和可执行文件”--- IIS认为这是一个ISAPI DLL,并运行它,如果你所有的可执行文件
  4. 你得到一个融合绑定你做的) - 里面有什么 - 应该是堆栈跟踪 - 你扔了吗?你能修好吗?
  5. 您是否与该网站建立了完全信任关系?
+0

好的,请参阅编辑 – Daniel 2009-06-22 16:08:49

0

请注意:IE8会禁用Internet区域中的用户控制,因此如果您打算在生产环境中部署此功能,请记住这一点。