Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Enterprise library 将企业库注册到GAC后无法解决类型运行时错误_Enterprise Library_Gac - Fatal编程技术网

Enterprise library 将企业库注册到GAC后无法解决类型运行时错误

Enterprise library 将企业库注册到GAC后无法解决类型运行时错误,enterprise-library,gac,Enterprise Library,Gac,我致力于将企业库程序集注册到全局程序集缓存(GAC)中。我使用的是我用自己的密钥签名的5.0版企业库,我在许多.NET 4.0应用程序中使用程序集 将企业库程序集成功注册到GAC后,应用程序启动时显示以下消息: 无法解析类型“Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter,Microsoft.Practices.EnterpriseLibrary.ExceptionHandling”。请

我致力于将企业库程序集注册到全局程序集缓存(GAC)中。我使用的是我用自己的密钥签名的5.0版企业库,我在许多.NET 4.0应用程序中使用程序集

将企业库程序集成功注册到GAC后,应用程序启动时显示以下消息:

无法解析类型“Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter,Microsoft.Practices.EnterpriseLibrary.ExceptionHandling”。请验证拼写是否正确或是否提供了完整的类型名称

当我从GAC注销企业库程序集时,应用程序将返回正常操作条件


当企业库程序集注册到GAC中时,是什么导致应用程序失败的?

这需要进行大量的搜索以找出发生了什么。事实证明,企业库在内部使用部分名称动态加载类型。在这种情况下,企业库试图动态加载Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter,因为它出现在配置文件中

要在运行时绕过部分名称引用,只需在配置文件中输入qualifyAssembly元素(请参见MSDN文档中的)

就我而言,我只需要输入以下条目:

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <qualifyAssembly partialName="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling" 
                       fullName="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
  </assemblyBinding>
</runtime>