2010-07-04 187 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內容,但它仍然存在,不會因爲它不直接暴露而忘記它在語言中。