title: Deploying ASP.NET MVC Internet application with MySQL on Apache/mod_mono
body: <p>First off, I'm pretty new to all this stuff.</p>
  
  <p>I use my Windows machine with Visual Studio 2013 Ultimate as development environment and want to host the created web application on a Linux machine using Apache/mod_mono.</p>
  
  <p>The Linux machine runs:</p>
  
  <ul>
  <li>CentOS release 6.5 (Final)</li>
  <li>Apache/2.2.15 (Unix) with mod_mono</li>
  <li>Mono JIT compiler version 3.10.0 (tarball Sat Oct  4 16:22:21 UTC 2014)</li>
  </ul>
  
  <p>I'm currently hosting 2 ASP.NET applications on the Linux machine:</p>
  
  <ol>
  <li><strong>monotest</strong>: an MVC project created with a MonoDevelop template mainly to test the apache configuration. This application works fine (even though the log throws errors when restarting apache)</li>
  <li><strong>webappexample</strong>: an MVC3 project with razor views and MySQL database created with the Visual Studio template. This website gives a '500 Internal Server Error'.</li>
  </ol>
  
  <p>When I restart Apache, this output is printed in the error_log:</p>
  
  <pre><code>[Tue Nov 04 11:03:30 2014] [notice] SIGHUP received.  Attempting to restart
  mod-mono-server received a shutdown message
  Missing method System.Configuration.IConfigurationSectionHandler::Create(object,object,XmlNode) in assembly /opt/mono/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll, referenced in assembly /opt/mono/lib/mono/gac/System.Configuration/4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
  Missing method System.Configuration.IConfigurationSectionHandler::Create(object,object,XmlNode) in assembly /opt/mono/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll, referenced in assembly /opt/mono/lib/mono/gac/System.Configuration/4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
  Missing method System.Configuration.ConfigurationManager::get_AppSettings() in assembly /var/www/html/webappexample/bin/System.Configuration.dll, referenced in assembly /opt/mono/lib/mono/gac/Mono.WebServer2/0.4.0.0__0738eb9f132ed756/Mono.WebServer2.dll
  mod-mono-server received a shutdown message
  [Tue Nov 04 11:03:31 2014] [notice] Digest: generating secret for digest authentication ...
  [Tue Nov 04 11:03:31 2014] [notice] Digest: done
  [Tue Nov 04 11:03:32 2014] [notice] Apache/2.2.15 (Unix) DAV/2 mod_mono/2.11 PHP/5.4.32 configured -- resuming normal operations
  mod-mono-server4
  mod-mono-server4
  mod-mono-server4
  Listening on: /tmp/mod_mono_server_monotest
  Root directory: /var/www/html/mono_test
  Exception caught during reading the configuration file:
  System.MissingMethodException: Method not found: 'System.Configuration.IConfigurationSectionHandler.Create'.
    at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection (System.String configKey) [0x0000d] in /home/abuild/rpmbuild/BUILD/mono-3.10.0/mcs/class/System.Configuration/System.Configuration/ClientConfigurationSystem.cs:62
    at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00000] in /home/abuild/rpmbuild/BUILD/mono-3.10.0/mcs/class/System.Configuration/System.Configuration/ConfigurationManager.cs:159
    at System.Configuration.ConfigurationManager.get_AppSettings () [0x00000] in /home/abuild/rpmbuild/BUILD/mono-3.10.0/mcs/class/System.Configuration/System.Configuration/ConfigurationManager.cs:173
    at Mono.WebServer.Apache.Server.get_AppSettings () [0x00001] in /home/abuild/rpmbuild/BUILD/xsp-1368532016/src/Mono.WebServer.Apache/main.cs:213
    at Mono.WebServer.Apache.Server+ApplicationSettings..ctor () [0x0002b] in /home/abuild/rpmbuild/BUILD/xsp-1368532016/src/Mono.WebServer.Apache/main.cs:63
  mod-mono-server4
  Listening on: /tmp/mod_mono_server_webappexample
  Root directory: /var/www/html/webappexample
  </code></pre>
  
  <p>And when I visit the webappexample, this is in the error_log:</p>
  
  <pre><code>System.NullReferenceException: Object reference not set to an instance of an object
    at Mono.WebServer.BaseApplicationHost.EndOfRequest (Mono.WebServer.MonoWorkerRequest mwr) [0x0002b] in /home/abuild/rpmbuild/BUILD/xsp-1368532016/src/Mono.WebServer/BaseApplicationHost.cs:141
    at Mono.WebServer.ModMonoApplicationHost.ProcessRequest (Int32 reqId, System.String verb, System.String queryString, System.String path, System.String protocol, System.String localAddress, Int32 serverPort, System.String remoteAddress, Int32 remotePort, System.String remoteName, System.String[] headers, System.String[] headerValues, System.Object worker) [0x00175] in /home/abuild/rpmbuild/BUILD/xsp-1368532016/src/Mono.WebServer.Apache/ModMonoApplicationHost.cs:109
    at (wrapper remoting-invoke-with-check) Mono.WebServer.ModMonoApplicationHost:ProcessRequest (int,string,string,string,string,string,int,string,int,string,string[],string[],object)
    at Mono.WebServer.ModMonoWorker.InnerRun (System.Object state) [0x002a7] in /home/abuild/rpmbuild/BUILD/xsp-1368532016/src/Mono.WebServer.Apache/ModMonoWorker.cs:253
    at Mono.WebServer.ModMonoWorker.Run (System.Object state) [0x00004] in /home/abuild/rpmbuild/BUILD/xsp-1368532016/src/Mono.WebServer.Apache/ModMonoWorker.cs:92
  [Tue Nov 04 11:37:55 2014] [error] (70014)End of file found: read_data failed
  [Tue Nov 04 11:37:55 2014] [error] Command stream corrupted, last command was -1
  </code></pre>
  
  <p>After some googling, I've came across quite a few blog posts about copying certain DLLs.. I've lost track of what I've tried so far but nothing solved my problem yet. I've also tried compiling webappexample with the mono compiler, this compiles without any warnings/errors but still doesn't solve my problem.    </p>
  
  <p>Can anyone provide some insights or solutions here?</p>