TypeLoadException on asp.net/xsp/mono on debian/opensuse

情到浓时终转凉″ 提交于 2019-12-12 05:09:39

问题


When i reset apache and load my website i get the first error below. I have no idea what the problem is. If i reload the page again (without restarting apache) i get the 2nd error, probably because the first error occurred and BaseUser is the first class/func that Application_Start uses.

Why am i getting this load exception? Whats messed up is i tried using mono's VMWare img to debug it and i got the very same exception (until i restarted which now refuses to give me anything but 404 errors). However when i use mono develop to run the project the site runs PERFECT. WTF.

Any ideas?

Server Error in '/' Application
A type load exception has occurred.

Description: HTTP 500. Error processing request.

Stack Trace:

System.TypeLoadException: A type load exception has occurred.
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod*,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 

Version information: Mono Runtime Version: 2.8.1 (tarball Mon Dec 27 10:20:03 UTC 2010); ASP.NET Version: 2.0.50727.1433

Second:

Server Error in '/' Application
Could not load type 'mynamespace.BaseUser' from assembly 'mynamespace, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

Description: HTTP 500. Error processing request.

Stack Trace:

System.TypeLoadException: Could not load type 'mynamespace.BaseUser' from assembly 'mynamespace, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
  at mynamespace.Global.Application_Start (System.Object sender, System.EventArgs e) [0x00000] in <filename unknown>:0 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod*,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 

Version information: Mono Runtime Version: 2.8.1 (tarball Mon Dec 27 10:20:03 UTC 2010); ASP.NET Version: 2.0.50727.1433

-edit- i'll mention that i tried MonoDevelops build of my site on both opensuse and my website and i get the exact same problem.


回答1:


I had lots of similar problems with Mono in Linux, but I managed to handle all of them.

I don't know if this works for you, but I would do xbuild prior to running xsp. It helped me lots of times, and I don't even know why it was required, since XSP is supposed, like ASP.NET usually does, to precompile the C# project prior to compiling the ASP.NET pages.

TypeLoadException occurs when the assembly's DLL cannot be loaded (in general also when the class is not present in the assembly, but that's not your case), so I guess that the ASP.NET's Bin directory is not filled with the application's code-behind DLL.

But... I also have a suspect: since mynamespace.Global.Application_Start is invoked, it means that your code behind has been compiled already, otherwise your error would be about the Global class.

Try with my advice and tell me what happens.



来源:https://stackoverflow.com/questions/4542077/typeloadexception-on-asp-net-xsp-mono-on-debian-opensuse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!