2010-07-04 188 views
0

我开发了一个使用C#和C++的Visual Studio 2008的Web服务。将Web服务部署到:Mono 500 - 内部服务器错误

我部署它是mod_mono服务被加载,但是当我尝试运行使用Invoke按钮,我得到的错误如下的方法,我与现代艺术博物馆的测试没有任何错误:

500 - Internal Server Error 

System.TypeInitializationException: An exception was thrown by the type initializer for <Module> ---> System.MissingMethodException: Method contains unsupported native code 

    at (wrapper managed-to-native) <Module>:<CrtImplementationDetails>.ThrowModuleLoadException (string,System.Exception) 

    at <Module>.<CrtImplementationDetails>.LanguageSupport.Initialize (<CrtImplementationDetails>.LanguageSupport*) [0x00000] 

    at <Module>..cctor() [0x00000] 

    --- End of inner exception stack trace --- 

    at I3WebService.Service1.Inferece (System.String value) [0x00000] 

    at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (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] 

谢谢。

一些更多的错误信息,当我使用PHP来调用web服务:

(/usr/lib/mono/2.0/mod-mono-server2.exe:1941): WARNING **: Method '<Module>:network.{ctor} (network*)' in assembly '/usr/local/zend/tmp/apache-temp-aspnet-0/54ae108a/assembly/shadow/a7cd17e2/c0c678fa_670b6f18_00000002/engine.dll' contains native code that cannot be executed by Mono on this platform. The assembly was probably created using C++/C 

回答

2

我认为错误的消息有很多在这里清楚。

contains native code that cannot be executed by Mono on this platform. The assembly was probably created using C++/C

不能Mono平台上使用C++/CLI除非C++/CLI模块是对 单平台编译。 Mono本身是平台独立的,但是你的程序集中的本地代码不是。

C++/CLI实际上是一种将本机代码与托管代码混合的方式 - 运行时处理幕后的所有P/Invoke内容,但它仍然存在,不会因为它不直接暴露而忘记它在语言中。