免责声明:我已经看到了确切的问题,但没有看到任何可以解决我问题的答案。
服务器:安装了带有ASP.NET 4.0 Framework(客户端配置文件和扩展)的Windows Server 2008
场景:这不会发生在我的开发服务器上,它只发生在我的生产服务器上,所以我的调试功能非常有限。
问题:当我点击使用EntityDataSource加载数据的页面时,我的elmah给了我这个。
System.Reflection.ReflectionTypeLoadException 无法加载一个或多个 要求的类型。检索 LoaderExceptions属性更多 信息。
没有非常有用的Stack Trace。所以我在Application_Error
内部使用了Global.asax
这样的事件来获取有关错误的更多详细信息。
void Application_Error(object sender, EventArgs e)
{
// Code that runs when an unhandled error occurs
StringBuilder sb = new StringBuilder();
Exception objErr = default(Exception);
objErr = Server.GetLastError().GetBaseException();
Server.ClearError();
if (objErr is ReflectionTypeLoadException) {
ReflectionTypeLoadException reflerror = default(ReflectionTypeLoadException);
reflerror = (ReflectionTypeLoadException)objErr;
foreach (var ex in reflerror.LoaderExceptions) {
sb.AppendLine(ex.Message);
}
}
sb.AppendLine("<b>Source:</b>" + Request.RawUrl);
sb.AppendLine("<br><b>Browser:</b>" + Request.UserAgent);
sb.AppendLine("<br><b>IP:</b>" + Request.UserHostAddress.ToString());
sb.AppendLine("<br><b>UserID:</b>" + User.Identity.Name);
sb.AppendLine("<hr><br><b>Error in: </b>" + Request.Url.ToString());
sb.AppendLine("<br><b>Error Message: </b>" + objErr.Message.ToString());
sb.AppendLine("<br><b>Stack Trace: </b><br>" + objErr.StackTrace.ToString());
Elmah.ErrorSignal.FromCurrentContext().Raise(new Exception(sb.ToString()));
}
现在我将错误记录为
System.Exception的
无法加载文件 或汇编'System.Web.Mvc, 版本= 3.0.0.0,文化=中立, PublicKeyToken = 31bf3856ad364e35'或 其中一个依赖项。系统 找不到指定的文件。 来源: /顾问/搜索
的浏览器:的Mozilla / 5.0 (Windows NT 6.1; rv:5.0) Gecko / 20100101 Firefox / 5.0
IP:我的IP
的用户名: user1020
错误: http://mysite.com/search
错误消息:无法执行 加载一个或多个请求的 类型。检索LoaderExceptions 物业了解更多信息。
堆栈追踪:
在 System.Reflection.RuntimeModule.GetTypes(RuntimeModule 模块) System.Reflection.RuntimeModule.GetTypes() 在 System.Reflection.Assembly.GetTypes() 在 System.Data.Metadata.Edm.ObjectItemConventionAssemblyLoader.LoadTypesFromAssembly() 在 System.Data.Metadata.Edm.ObjectItemAssemblyLoader.Load() 在 System.Data.Metadata.Edm.AssemblyCache.LoadAssembly(大会 assembly,布尔值 loadReferencedAssemblies, ObjectItemLoadingSessionData loadingData)at System.Data.Metadata.Edm.AssemblyCache.LoadAssembly(大会 assembly,布尔值 loadReferencedAssemblies, KnownAssembliesSet已知的组件, EdmItemCollection edmItemCollection, 动作1 logLoadMessage, Object& loaderCookie, Dictionary
2及 typesInLoading,List`1&amp;错误)....(跟踪继续)
请看第一行。
在ASP.NET方案中System.Web.Mvc, Version=3.0.0.0
做什么?
我已经要求我的服务器人员安装MVC3。但这确实没有任何意义
任何帮助/指针将不胜感激。很长一段时间我都没有对asp.net感到困惑:(
为什么会出现此错误以及什么是一个好的解决方案/解决方法?
答案 0 :(得分:3)
我遇到了需要使用MVC的第三方参考问题,想到了DotNetOpenAuth。