2011-12-18 169 views
2

我可以在Mono上托管一个小型MVC3应用程序,但是当尝试托管我的真实站点时,我会遇到一些例外情况。在Mono上托管MVC3应用程序

版本:

  • 单声道2.10.6
  • C#中使用剃刀
  • NHibernate的4
  • MVC3 3.1.0.4
  • FluentNHibernate 1.2.0.712
  • MySql.Data 6.4。 4.0
  • MvcContrib 3.0.51.0

这里我试图在我的Windows机器上运行xsp4,但是我在Linux上遇到同样的错误。

我使用--verbose没有得到任何附加信息。有人知道为什么会出现这种错误,或者我可以如何获得有关错误的其他信息?

 
Handling exception type TargetInvocationException 
Message is Exception has been thrown by the target of an invocation. 
IsTerminating is set to True 
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. 

Server stack trace: 
    at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0 
    at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in :0 
    at System.Runtime.Serialization.ObjectRecord.LoadData (System.Runtime.Serialization.ObjectManager manager, ISurrogateSelector selector, StreamingContext context) [0x00000] in :0 
    at System.Runtime.Serialization.ObjectManager.DoFixups() [0x00000] in :0 
    at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadNextObject 
(System.IO.BinaryReader reader) [0x00000] in :0 
    at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectGraph (BinaryElement elem, System.IO.BinaryReader reader, Boolean readHeaders, System.Object& result, System.Runtime.Remoting.Messaging.Header[]& headers) [0x00000] 
in :0 
    at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.NoCheckDeserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler) [0x00000] in :0 
    at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize 
(System.IO.Stream serializationStream) [0x00000] in :0 
    at System.Runtime.Remoting.RemotingServices.DeserializeCallData (System.Byte[] array) [0x00000] in :0 
    at (wrapper xdomain-dispatch) System.AppDomain:DoCallBack (object,byte[]&,byte[]&) 

Exception rethrown at [0]: 
---> System.ArgumentException: Couldn't bind to method 'SetHostingEnvironment'. 
    at System.Delegate.GetCandidateMethod (System.Type type, System.Type target, System.String method, BindingFlags bflags, Boolean ignoreCase, Boolean throwOnBindFailure) [0x00000] in :0 
    at System.Delegate.CreateDelegate (System.Type type, System.Type target, System.String method, Boolean ignoreCase, Boolean throwOnBindFailure) [0x00000] in :0 
    at System.Delegate.CreateDelegate (System.Type type, System.Type target, System.String method) [0x00000] in :0 
    at System.DelegateSerializationHolder+DelegateEntry.DeserializeDelegate (System.Runtime.Serialization.SerializationInfo info) [0x00000] in :0 
    at System.DelegateSerializationHolder..ctor (System.Runtime.Serialization.SerializationInfo info, StreamingContext ctx) [0x00000] in :0 
    at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&) 
    at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0 
    --- End of inner exception stack trace --- 
    at (wrapper xdomain-invoke) System.AppDomain:DoCallBack (System.CrossAppDomainDelegate) 
    at (wrapper remoting-invoke-with-check) System.AppDomain:DoCallBack (System.CrossAppDomainDelegate) 
    at System.Web.Hosting.ApplicationHost.CreateApplicationHost (System.Type hostType, System.String virtualDir, System.String physicalDir) [0x00000] in :0 
    at Mono.WebServer.VPathToHost.CreateHost (Mono.WebServer.ApplicationServer server, Mono.WebServer.WebSource webSource) [0x00000] in :0 
    at Mono.WebServer.XSP.Server.RealMain (System.String[] args, Boolean root, IApplicationHost ext_apphost, Boolean quiet) [0x00000] in :0 
    at Mono.WebServer.XSP.Server.Main (System.String[] args) [0x00000] in :0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.Reflection.TargetInvocationException: 
Exception has been thrown by the target of an invocation. 

Server stack trace: 
    at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0 
    at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in :0 
    at System.Runtime.Serialization.ObjectRecord.LoadData (System.Runtime.Serialization.ObjectManager manager, ISurrogateSelector selector, StreamingContext context) [0x00000] in :0 
    at System.Runtime.Serialization.ObjectManager.DoFixups() [0x00000] in :0 
    at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadNextObject 
(System.IO.BinaryReader reader) [0x00000] in :0 
    at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectGraph (BinaryElement elem, System.IO.BinaryReader reader, Boolean readHeaders, System.Object& result, System.Runtime.Remoting.Messaging.Header[]& headers) [0x00000] 
in :0 
    at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.NoCheckDeserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler) [0x00000] in :0 
    at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize 
(System.IO.Stream serializationStream) [0x00000] in :0 
    at System.Runtime.Remoting.RemotingServices.DeserializeCallData (System.Byte[] array) [0x00000] in :0 
    at (wrapper xdomain-dispatch) System.AppDomain:DoCallBack (object,byte[]&,byte[]&) 

Exception rethrown at [0]: 
---> System.ArgumentException: Couldn't bind to method 'SetHostingEnvironment'. 
    at System.Delegate.GetCandidateMethod (System.Type type, System.Type target, System.String method, BindingFlags bflags, Boolean ignoreCase, Boolean throwOnBindFailure) [0x00000] in :0 
    at System.Delegate.CreateDelegate (System.Type type, System.Type target, System.String method, Boolean ignoreCase, Boolean throwOnBindFailure) [0x00000] in :0 
    at System.Delegate.CreateDelegate (System.Type type, System.Type target, System.String method) [0x00000] in :0 
    at System.DelegateSerializationHolder+DelegateEntry.DeserializeDelegate (System.Runtime.Serialization.SerializationInfo info) [0x00000] in :0 
    at System.DelegateSerializationHolder..ctor (System.Runtime.Serialization.SerializationInfo info, StreamingContext ctx) [0x00000] in :0 
    at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&) 
    at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0 
    --- End of inner exception stack trace --- 
    at (wrapper xdomain-invoke) System.AppDomain:DoCallBack (System.CrossAppDomainDelegate) 
    at (wrapper remoting-invoke-with-check) System.AppDomain:DoCallBack (System.CrossAppDomainDelegate) 
    at System.Web.Hosting.ApplicationHost.CreateApplicationHost (System.Type hostType, System.String virtualDir, System.String physicalDir) [0x00000] in :0 
    at Mono.WebServer.VPathToHost.CreateHost (Mono.WebServer.ApplicationServer server, Mono.WebServer.WebSource webSource) [0x00000] in :0 
    at Mono.WebServer.XSP.Server.RealMain (System.String[] args, Boolean root, IApplicationHost ext_apphost, Boolean quiet) [0x00000] in :0 
    at Mono.WebServer.XSP.Server.Main (System.String[] args) [0x00000] in :0 
+0

并行单声道安装/ GAC问题可能吗?看看这个帖子:http://lists.ximian.com/pipermail/mono-list/2009-December/044136.html否则发布一个bug。 – 2011-12-18 13:22:35

回答

3

我找到了原因。我有几个System.Web。* dll的bin文件夹。删除这些修复问题。

+0

你的意思是说你有重复的东西,或者你刚刚从你的垃圾箱中删除了所有的system.web。*文件? – Chazt3n 2013-02-11 21:56:34

+0

@ Chazt3n:不记得了。这是一岁以上:) – simendsjo 2013-02-12 10:43:07

+0

好吧没问题,我得到同样的错误,我不能为我的生活理解为什么呢:/ – Chazt3n 2013-02-12 13:59:40

1

问题仍然存在于MVC 4/5上。该DLL是System.Web.dll。发布到单声道时必须将其删除。

1

用Xamarin创建一个Mvc项目。您需要的dll将位于bin文件夹中。将工作得很好

相关问题