无法加载一个或多个请求的类型。检索LoaderExceptions属性以获取更多信息 [英] Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information

查看:638
本文介绍了无法加载一个或多个请求的类型。检索LoaderExceptions属性以获取更多信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Server Error in '/' Application.

Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

Source Error: 

Line 251:                </center>
Line 252:    </div><br />
Line 253:     <asp:ToolkitScriptManager ID="toolKitScriptManager" runat="server">
Line 254:          </asp:ToolkitScriptManager>
Line 255:           <div>

Source File:asasas.aspx    Line: 253 

Stack Trace: 

[ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.]
   System.Reflection.RuntimeModule.GetTypes(RuntimeModule module) +0
   System.Reflection.RuntimeModule.GetTypes() +4
   System.Reflection.Assembly.GetTypes() +78
   AjaxControlToolkit.ToolkitScriptManagerConfig..cctor() +74

[TypeInitializationException: The type initializer for 'AjaxControlToolkit.ToolkitScriptManagerConfig' threw an exception.]
   AjaxControlToolkit.ToolkitScriptManagerConfig..ctor(IAjaxControlToolkitCacheProvider cacheProvider) +0
   AjaxControlToolkit.ToolkitScriptManager..ctor() +57
 .........
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +100
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75



我是faci这个问题只有当我在服务器上传,否则在本地机器上它工作正常

plzz帮我解决..



Thanx in advance


I am facing this problem only when i am uploading it on server otherwise on local machine it works fine
plzz help me out..

Thanx in advance

推荐答案

将此代码放入web.config

并查看您的工具包版本

< br $> b $ b

put this code in web.config
and check out your version of an toolkit


<configsections>
		
			<sectiongroup name="system.web.extensions">
        type="System.Web.Configuration.SystemWebExtensionsSectionGroup, 
      System.Web.Extensions, Version=3.5.0.0, Culture=neutral,  
      PublicKeyToken=31BF3856AD364E35">

      <sectiongroup name="scripting">
        type="System.Web.Configuration.ScriptingSectionGroup, 
        System.Web.Extensions, Version=3.5.0.0, Culture=neutral, 
        PublicKeyToken=31BF3856AD364E35">

        

        <sectiongroup name="webServices">
          type="System.Web.Configuration.ScriptingWebServicesSectionGroup,
          System.Web.Extensions, Version=3.5.0.0, Culture=neutral, 
          PublicKeyToken=31BF3856AD364E35">

          

          
         

          

        </sectiongroup>
      </sectiongroup>
    </sectiongroup>

</configsections>





谢谢



thank you


在Web.Config文件中添加以下行,它将起作用.....它的工作原理在我的情况下因为我有同样的问题。



Add the following line in Web.Config file and it will work.....it works in my case coz i had same problem.

<system.web>

   <trust level="Full" />


您可以通过将项目引用的Copy Local属性设置为true来解决此问题!



说明



1-在解决方案资源管理器中,单击显示所有文件按钮以显示参考节点。

2-打开项目的参考节点。

3-右键单击参考列表中的参考,然后单击属性。 />
与该参考相关联的属性显示在属性窗口的列表中。

4-从中选择复制本地左侧列,然后单击右侧列中的箭头将值更改为 True False



您也可以使用以下代码用于识别缺少的内容



You may solve this issue by setting the Copy Local attribute of your project's references to true!

Instructions

1- In Solution Explorer, click the Show All Files button to display the References node.
2- Open the References node for the project.
3- Right-click a reference in the References list, and click Properties.
The properties associated with that reference appear in a list in the Properties window.
4- Select Copy Local from the left-hand column, and then click the arrow in the right-hand column to change the value to True or False.

You may also use the following code to identify what is missing

<pre lang="c#">

使用System.IO;

使用System.Reflection;

使用System.Text;



尝试

{

//导致错误的代码在这里。

}

catch(ReflectionTypeLoadException ex)

{

StringBuilder sb = new StringBuilder();

foreach(ex.LoaderExceptions中的异常exSub)

{

sb。 AppendLine(exSub.Message);

FileNotFoundException exFileNotFound = exSub as FileNotFoundException;

if(exFileNotFound!= null)

{

if(!string.IsNullOrEmpt y(exFileNotFound.FusionLog))

{

sb.AppendLine(Fusion Log:);

sb.AppendLine(exFileNotFound.FusionLog );

}

}

sb.AppendLine();

}

string errorMessage = sb.ToString();

//根据您的应用程序显示或记录错误。

}







参考资料

msdn,堆栈溢出。

using System.IO;
using System.Reflection;
using System.Text;

try
{
//The code that causes the error goes here.
}
catch (ReflectionTypeLoadException ex)
{
StringBuilder sb = new StringBuilder();
foreach (Exception exSub in ex.LoaderExceptions)
{
sb.AppendLine(exSub.Message);
FileNotFoundException exFileNotFound = exSub as FileNotFoundException;
if (exFileNotFound != null)
{
if(!string.IsNullOrEmpty(exFileNotFound.FusionLog))
{
sb.AppendLine("Fusion Log:");
sb.AppendLine(exFileNotFound.FusionLog);
}
}
sb.AppendLine();
}
string errorMessage = sb.ToString();
//Display or log the error based on your application.
}



References
msdn, stack overflow.


这篇关于无法加载一个或多个请求的类型。检索LoaderExceptions属性以获取更多信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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