Mono 3.0.0: Failed to load file or assembly: System.Web.Extensions.dll, Version = 4.0.0.0

I host the ServiceStack web service on Apache with mod-mono, I have mono-3.0.0 and xsp-2.10.2. I posted a welcome sample focused on the .NET Framework 2.0 and using mod-mono-server2, and it worked fine. Then I change the project to the target .Net framework 4.0 and using mod-mono-server4. I get this error:

Failed to load file or assembly "System.Web.Extensions, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35" or one of its dependencies. The system cannot find the specified file.

System.IO.FileNotFoundException: Failed to load file or assembly "System.Web.Extensions, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35" or one of its dependencies. The system cannot find the specified file. File name: 'System.Web.Extensions, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35' in System.AppDomain.Load (System.String assemblyString, System.Security.Policy.Evidence assemblySecurity, Boolean refonly) [0x00000 ] at: 0 at System.AppDomain.Load (System.String assemblyString) [0x00000] at: 0 at (wrapper remoting-invoke-with-check) System.AppDomain: Load (string) in System.Reflection.Assembly.Load ( System.String assemblyString) [0x00000] at: 0 in System.Web.Compilation.BuildManager.LoadAssembly (System.Web.Configuration.AssemblyInfo info, System.Collections.Generic.List`1 al) [0x00000] at: 0 in System .Web.Compilation.BuildManager.GetReferencedAssemblies () [0x00000] at: 0 in System.Web.Compilation.BuildManager.CallPreStartMethods () [0x00000] at: 0

But the System.Web.Extensions file is installed in the GAC:

gacutil -l System.Web.Extensions

The following assemblies are installed in the GAC: System.Web.Extensions, Version = 1.0.61025.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35 System.Web.Extensions, Version = 3.5.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35 System.Web.Extensions, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35 Number of elements = 3

Even if I installed MonoPath specifically to get version 4.0, the same error occurs:

MonoPath / usr / local / lib / mono / 4.0

I also noticed this:

Version Information: Mono Runtime Version: 2.10.5 (tarball Fri Oct 28 10:20:24 IST 2011); ASP.NET Version: 4.0.30319.1

The version of Mono Runtime says 2.10.5, although I have mono-3.0.0 installed, I don’t know if this information is of value to this problem.

I tried to run mod-mono-server4 directly, and I received this error message:

mono server mod4

mono-server mod4 There is no System.Configuration.IConfigurationSectionHandler :: Create method (object, object, XmlNode) in assembly / usr / local / lib / mono / 4.0 / System.dll, assembly reference / usr / local / lib / mono / 4.0 / System. Configuration.dll Exception while reading a configuration file: System.MissingMethodException: method not found: 'System.Configuration.IConfigurationSectionHandler.Create'. in System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection (System.String configKey) [0x00000] at: 0 in System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00000] in .Configuration.ConfigurationManager.get_AppSettings () [0x00000] at: 0 in Mono.WebServer.Apache.Server.get_AppSettings () [0x00000] at: 0 in Mono.WebServer.Apache.Server + ApplicationSettings..ctor () [0x00000] to: 0 mod-mono server 4 Listening: / tmp / mod_mono_server Root directory: / usr / local / bin Error: the server / tmp / mod _mono_server is already listening there

I searched for this error and searched for this error:

https://bugzilla.xamarin.com/show_bug.cgi?id=7967

Maybe the error in mod-mono-server4 is the source of another error ... I will try to get xsp 3.0 and see if it solves the problem.

Any ideas?

thanks

+4
source share
1 answer

This error occurs due to a problem in the System.Configuration assembly for implementing the Mono .NET 4.0 framework when using Mod_Mono / XSP. It tries to read the key "appSetting" MonoServerDefaultIndexFiles ", but cannot find the Create factory method.

It took a day or two to realize that the solution was to edit the next file ...

/ Opt / mono / bin / obr-mono server4

... by changing the default value of 4.0 to 4.5 in this line:

exec / opt / mono / bin / mono $ MONO_OPTIONS "/ opt / mono / lib / mono / 4.5 /mod-mono-server4.exe" "$ @"

With this solution, the next problem I ran into was that Mono replaces the built-in AspNetMembershipProvider with SqliteMembershipProvider via the "Settings Map" function. I added the following line in the "Web.config Application Settings" section to disable this default behavior:

"<add key =" MonoAspnetInhibitSettingsMap "value =" disabled "/>"

After a couple of days of persecution, my MVC3 application was successfully launched on Mono 3.0.3 (the last at the time of this writing) / XSP 2.10 / Mod_Mono 2.10

+5
source

All Articles