每次回收工作进程后都会发生似乎是 .net 错误的情况。仅当我使用实体框架时才会发生
我编写了一个 vb.net 项目(.net 4),它似乎在我的 Windows 7 计算机上完美运行,并且在发布到 Windows Server 2003 服务器时似乎也运行良好。
在我的服务器上几个小时后,问题出现了,我收到臭名昭著的“无法加载一种或多种请求的类型。检索 LoaderExceptions 属性以获取更多信息”。我在使用Visual Studio的时候根本没见过这个问题。
在我看来,这似乎表明对 dll/某些内容的引用由于缓存过程而丢失。将任何内容上传到该文件夹可暂时修复该问题(包括 test.txt 文件)。然后几个小时后问题又回来了。
我已关闭服务器上的搜索索引并确保服务器是最新的..但错误不断返回。 (经调查,每次工作进程回收时它都会返回)
该问题似乎只出现在某些 ascx 文件上,这些文件引用了引用订单表的 EntityDataSource。
另外,我尝试使用以下代码获取 LoaderExceptions 和任何其他数据:
Try
OrdersTable.DataBind()
Catch ex As ReflectionTypeLoadException
Response.Write(ex.Message)
If (Not ex.InnerException Is Nothing) Then
Response.Write(ex.InnerException.Message)
Response.Write(ex.LoaderExceptions)
For Each Parameter As DictionaryEntry In ex.Data
Dim key As Object = Parameter.Key
Dim value As Object = Parameter.Value
Response.Write(key & ":" & value & "<br>\n")
Next
End If
Response.End()
End Try
所写的所有内容与之前的错误“无法加载一个或多个...”
对于 .net 框架来说是新的,因此任何建议都将是非常感谢:)。
编辑: 附加堆栈跟踪。
[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
System.Data.Metadata.Edm.ObjectItemConventionAssemblyLoader.LoadTypesFromAssembly() +32
System.Data.Metadata.Edm.ObjectItemAssemblyLoader.Load() +25
System.Data.Metadata.Edm.AssemblyCache.LoadAssembly(Assembly assembly, Boolean loadReferencedAssemblies, ObjectItemLoadingSessionData loadingData) +160
System.Data.Metadata.Edm.AssemblyCache.LoadAssembly(Assembly assembly, Boolean loadReferencedAssemblies, KnownAssembliesSet knownAssemblies, EdmItemCollection edmItemCollection, Action1 logLoadMessage, Object& loaderCookie, Dictionary2& typesInLoading, List1& errors) +166
System.Data.Metadata.Edm.ObjectItemCollection.LoadAssemblyFromCache(ObjectItemCollection objectItemCollection, Assembly assembly, Boolean loadReferencedAssemblies, EdmItemCollection edmItemCollection, Action1 logLoadMessage) +316
System.Data.Metadata.Edm.ObjectItemCollection.ExplicitLoadFromAssembly(Assembly assembly, EdmItemCollection edmItemCollection, Action1 logLoadMessage) +53
System.Data.Metadata.Edm.MetadataWorkspace.ExplicitLoadFromAssembly(Assembly assembly, ObjectItemCollection collection, Action1 logLoadMessage) +93
System.Data.Metadata.Edm.MetadataWorkspace.LoadFromAssembly(Assembly assembly, Action1 logLoadMessage) +130
System.Web.UI.WebControls.EntityDataSourceView.ConstructContext() +585
System.Web.UI.WebControls.EntityDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +76
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +21
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +143
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
System.Web.UI.WebControls.GridView.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +66
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +75
System.Web.UI.Control.EnsureChildControls() +102
System.Web.UI.Control.PreRenderRecursiveInternal() +42
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496
I've written a vb.net project (.net 4) that seems to work perfectly on my windows 7 machine, and seems to work fine when published to a windows server 2003 server.
The issue comes after a few hours on my server, I get the infamous "Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information". I haven't seen this problem at all when using visual studio.
Which seems to suggest to me that a reference to a dll / something is lost due to a cache process. Uploading anything to that folder temporally fixes the issue (including a test.txt file). Then after a few hours the issue returns.
I've turned off search indexing on the server and insured that the server is up to date.. but the error keeps on returning. (on investigation it returns every time the worker process recycles)
The issue only seems to appear on certain ascx files, these files reference an EntityDataSource that references an orders table.
Also I have attempted to get the LoaderExceptions and any other data with the following code:
Try
OrdersTable.DataBind()
Catch ex As ReflectionTypeLoadException
Response.Write(ex.Message)
If (Not ex.InnerException Is Nothing) Then
Response.Write(ex.InnerException.Message)
Response.Write(ex.LoaderExceptions)
For Each Parameter As DictionaryEntry In ex.Data
Dim key As Object = Parameter.Key
Dim value As Object = Parameter.Value
Response.Write(key & ":" & value & "<br>\n")
Next
End If
Response.End()
End Try
All that is written is the same error as before "Unable to load one or more of..."
New to the .net framework so any suggestions will be very much appreciated :).
Edit:
Stack trace attached.
[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
System.Data.Metadata.Edm.ObjectItemConventionAssemblyLoader.LoadTypesFromAssembly() +32
System.Data.Metadata.Edm.ObjectItemAssemblyLoader.Load() +25
System.Data.Metadata.Edm.AssemblyCache.LoadAssembly(Assembly assembly, Boolean loadReferencedAssemblies, ObjectItemLoadingSessionData loadingData) +160
System.Data.Metadata.Edm.AssemblyCache.LoadAssembly(Assembly assembly, Boolean loadReferencedAssemblies, KnownAssembliesSet knownAssemblies, EdmItemCollection edmItemCollection, Action1 logLoadMessage, Object& loaderCookie, Dictionary2& typesInLoading, List1& errors) +166
System.Data.Metadata.Edm.ObjectItemCollection.LoadAssemblyFromCache(ObjectItemCollection objectItemCollection, Assembly assembly, Boolean loadReferencedAssemblies, EdmItemCollection edmItemCollection, Action1 logLoadMessage) +316
System.Data.Metadata.Edm.ObjectItemCollection.ExplicitLoadFromAssembly(Assembly assembly, EdmItemCollection edmItemCollection, Action1 logLoadMessage) +53
System.Data.Metadata.Edm.MetadataWorkspace.ExplicitLoadFromAssembly(Assembly assembly, ObjectItemCollection collection, Action1 logLoadMessage) +93
System.Data.Metadata.Edm.MetadataWorkspace.LoadFromAssembly(Assembly assembly, Action1 logLoadMessage) +130
System.Web.UI.WebControls.EntityDataSourceView.ConstructContext() +585
System.Web.UI.WebControls.EntityDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +76
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +21
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +143
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
System.Web.UI.WebControls.GridView.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +66
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +75
System.Web.UI.Control.EnsureChildControls() +102
System.Web.UI.Control.PreRenderRecursiveInternal() +42
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
必须尝试使用 Fusion Log Viewer 工具吗?它应该给您一些提示,尽管有时太冗长...可在此处获取 http:// msdn.microsoft.com/en-us/library/e74a18c4
Have to tried to use the Fusion Log Viewer tool? It should give you some hints, although it's sometimes too verbose... Available here http://msdn.microsoft.com/en-us/library/e74a18c4
最后,对我来说最简单的解决方案是不做导致错误出现的事情。
我现在不再在设计时绑定任何数据。
成为
它也意味着我现在必须自己处理删除/选择等,这有点令人恼火,但可以管理。
In the end the solution that was easiest for me was to not do what was causing the bug to surface.
I now no longer bind any data at design time.
Becomes
It also means that I now have to handle deleting / selecting etc. myself, which is a little irritating, however manageable.