0

I have a project that ofc deploys ok a Windows server, but i'd like to try deploying it to a apache + mod-mono server.

I've got it working through many other errors related to missing DLLs etc. But now i am facing one that I cannot get past.

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:71.0) Gecko/20100101 Firefox/71.0 UserHostAddress: 192.168.1.192 UserHostName: 192.168.1.192

We have caught a new error on http://local.website/Account/Login

Error message was: Method not found: void System.Web.HttpCookie.set_Shareable(bool) Stack trace:

at (wrapper dynamic-method) System.Object.lambda_method(System.Runtime.CompilerServices.Closure,System.Web.Mvc.ControllerBase,object[]) at System.Web.Mvc.ActionMethodDispatcher.Execute (System.Web.Mvc.ControllerBase controller, System.Object[] parameters) [0x00000] in :0 at System.Web.Mvc.ReflectedActionDescriptor.Execute (System.Web.Mvc.ControllerContext controllerContext, System.Collections.Generic.IDictionary2[TKey,TValue] parameters) [0x00072] in :0 at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod (System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ActionDescriptor actionDescriptor, System.Collections.Generic.IDictionary2[TKey,TValue] parameters) [0x00000] in :0 at System.Web.Mvc.Async.AsyncControllerActionInvoker+ActionInvocation.InvokeSynchronousActionMethod () [0x00000] in :0 at System.Web.Mvc.Async.AsyncControllerActionInvoker.b__39 (System.IAsyncResult asyncResult, System.Web.Mvc.Async.AsyncControllerActionInvoker+ActionInvocation innerInvokeState) [0x00000] in :0 at (wrapper delegate-invoke) System.Web.Mvc.Async.EndInvokeDelegate2[System.Web.Mvc.Async.AsyncControllerActionInvoker+ActionInvocation,System.Web.Mvc.ActionResult].invoke_TResult_IAsyncResult_TState(System.IAsyncResult,System.Web.Mvc.Async.AsyncControllerActionInvoker/ActionInvocation) at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncResult2[TResult,TState].CallEndDelegate (System.IAsyncResult asyncResult) [0x00000] in :0 at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncResultBase1[TResult].End () [0x00029] in :0 at System.Web.Mvc.Async.AsyncResultWrapper.End[TResult] (System.IAsyncResult asyncResult, System.Object tag) [0x00007] in :0
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod (System.IAsyncResult asyncResult) [0x00000] in :0 at System.Web.Mvc.Async.AsyncControllerActionInvoker+AsyncInvocationWithFilters.b__3d () [0x00014] in :0 at System.Web.Mvc.Async.AsyncControllerActionInvoker+AsyncInvocationWithFilters+<>c__DisplayClass46.b__3f () [0x00086] in :0 at System.Web.Mvc.Async.AsyncControllerActionInvoker+AsyncInvocationWithFilters+<>c__DisplayClass46.b__3f () [0x00086] in :0 at System.Web.Mvc.Async.AsyncControllerActionInvoker+<>c__DisplayClass33.b__32 (System.IAsyncResult asyncResult) [0x00000] in :0 at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncResult
1[TResult].CallEndDelegate (System.IAsyncResult asyncResult) [0x00000] in :0 at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncResultBase`1[TResult].End () [0x00029] in :0 at System.Web.Mvc.Async.AsyncResultWrapper.End[TResult] (System.IAsyncResult asyncResult, System.Object tag) [0x00007] in :0
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters (System.IAsyncResult asyncResult) [0x00000] in :0 at System.Web.Mvc.Async.AsyncControllerActionInvoker+<>c__DisplayClass21+<>c__DisplayClass2b.b__1c () [0x00000] in :0 at System.Web.Mvc.Async.AsyncControllerActionInvoker+<>c__DisplayClass21.b__1e (System.IAsyncResult asyncResult) [0x00000] in :0

The virtual host for the website looks like this:


    <VirtualHost *:80>
        DocumentRoot "/var/www/my.website"
        ServerName local.website
        MonoDebug local.website true
        MonoSetEnv local.website MONO_IOMAP=all
        MonoServerPath local.website "/usr/bin/mod-mono-server4"

        MonoAutoApplication disabled
        AddHandler mono .aspx .ascx .asax .ashx .config .cs .asmx .axd
        MonoApplications local.website "/:/var/www/my.website"
        MonoMaxActiveRequests 20
        MonoMaxWaitingRequests 20
        ErrorLog /var/www/logs/local.website.log

      <Location "/">
        Allow from all
        Order allow,deny
        MonoSetServerAlias local.website
        SetHandler mono
        SetOutputFilter DEFLATE
        SetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png)$" no-gzip dont-vary
      </Location>
      <IfModule mod_deflate.c>
        AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript
      </IfModule>

      <Directory />
            Options FollowSymLinks
            AllowOverride None
      </Directory>

    </VirtualHost>

The mod-mono.conf file looks like this:


    <IfModule !mod_mono.c>
        LoadModule mono_module /usr/lib64/httpd/modules/mod_mono.so
    </IfModule>

    <IfModule mod_headers.c>
        Header set X-Powered-By "Mono Camerolla"
    </IfModule>

    AddType application/x-asp-net .aspx
    AddType application/x-asp-net .asmx
    AddType application/x-asp-net .ashx
    AddType application/x-asp-net .asax
    AddType application/x-asp-net .ascx
    AddType application/x-asp-net .soap
    AddType application/x-asp-net .rem
    AddType application/x-asp-net .axd
    AddType application/x-asp-net .cs
    AddType application/x-asp-net .vb
    AddType application/x-asp-net .master
    AddType application/x-asp-net .sitemap
    AddType application/x-asp-net .resources
    AddType application/x-asp-net .skin
    AddType application/x-asp-net .browser
    AddType application/x-asp-net .webinfo
    AddType application/x-asp-net .resx
    AddType application/x-asp-net .licx
    AddType application/x-asp-net .csproj
    AddType application/x-asp-net .vbproj
    AddType application/x-asp-net .config
    AddType application/x-asp-net .Config
    AddType application/x-asp-net .dll
    DirectoryIndex index.aspx
    DirectoryIndex Default.aspx
    DirectoryIndex default.aspx

    # add setting
    # MonoAutoApplication disabled

    AddMonoApplications default "/:/var/www/html"

    MonoServerPath default "/usr/bin/mod-mono-server4"

    <Location />
        SetHandler mono
        MonoSetServerAlias default
    </Location>

    <Directory "/var/www/html">
    AllowOverride None
    Require all granted
    </Directory>

    <IFModule mono_module>
        ForceType application/x-asp-net

        MonoAutoApplication enabled
        MonoDebug true
        MonoServerPath "/usr/bin/mod-mono-server4"
        MonoUnixSocket "/tmp/.mod_mono"

        <IfModule dir_module>
            DirectoryIndex Default.aspx
        </IfModule>

        <DirectoryMatch "/(bin|App_Code|App_Data|App_GlobalResources|App_LocalResources)/">
            Order deny,allow
            Deny from all
        </DirectoryMatch>

        <Location "/Mono">
            Order deny,allow
            Deny from all
            Allow from 127.0.0.1 ::1 192.168.1.192
            SetHandler mono-ctrl
        </Location>
    </IfModule>

Any idea what could be the issue?

P.S. Instead redirecting me to /Account/Login, it also redirects me to "login.aspx?ReturnUrl=%2f"

Sebi O.
  • 23
  • 6
  • The issue is that something in your code is directly or indirectly attempting to assign a value to the `System.Web.HttpCookie.Shareable` property, and Mono doesn't implement that property. Since Mono is dead, due to .NET Core having runtimes for all major platforms, this is unsurprising and will not be fixed. – Ian Kemp Jan 03 '20 at 00:34
  • Thank you, indeed that was the issue. Would you rather recommend porting the entire website to .net core instead? I didn't expect that mono project would die to be honest. – Sebi O. Jan 03 '20 at 06:39
  • My suggestion is to install .NET Core on the server you're playing on, and see if your site works with it. If it does (highly likely unless you have extra HTTP modules or similar weirdness) then you won't need to do anything else. – Ian Kemp Jan 03 '20 at 11:56
  • Thanks Ian. I ended up successfully using the website under mod_mono... used the DEBUG options in mono in order to findout what was wrong and apparently i messed-up the DLL libraries so much ... that it screwed things :) – Sebi O. Jan 06 '20 at 14:55

0 Answers0