This is a migrated thread and some comments may be shown as answers.

[Solved] Assets support on Mono

16 Answers 176 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Igor
Top achievements
Rank 2
Igor asked on 11 Oct 2011, 04:31 PM
Hi

I working with Telerik MVC on Mono 2.10, Apache 2 and it works well, except one thing

In my code on Site.Master i have the following fragment for content registration:
<%= Html.Telerik().StyleSheetRegistrar()
        .DefaultGroup(group => group
        .Add("telerik.common.css")
        .Add("telerik.black.css")
        .Combined(true)
        .Compress(true)) %>
and same code for ScriptRegistrar:

<% Html.Telerik()
.ScriptRegistrar().Globalization(true)
.Combine(true)
.Compresss(true)
.Render(); %>


in the web.config file i have all handlers inserted:

<httpHandlers>
...
<add verb="GET,HEAD" path="asset.axd" validate="false" type="Telerik.Web.Mvc.WebAssetHttpHandler, Telerik.Web.Mvc" />
 
...
</httpHandlers>
 
....
   <system.webServer>
    
    <validation validateIntegratedModeConfiguration="false" />
......
 <handlers>
      <add name="asset" preCondition="integratedMode" verb="GET,HEAD" path="asset.axd" type="Telerik.Web.Mvc.WebAssetHttpHandler, Telerik.Web.Mvc" />


But when opening webpage i have 404 server error on the .axd resource that Telerik http handler uses for compress CSS and JS content, and browser cannot load content to show page properly. Same issue can be reproduced on Apache 2 server and XSP 4 as well.

When disabling combine and compress - everything works well.

.Combined(false)
.Compress(false))

The page content loads with no issues.
When using .NET runtime instead - i have no such issues at all.

Could you please give me some advices, how to make these handlers to work with Mono?
Thanks!

16 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 12 Oct 2011, 10:29 AM
Hello Igor,

 It sees that for some reason the HTTP handler registration does not work in Mono or just requires some extra steps. I found the following resources which may be helpful:

http://mono.1490590.n4.nabble.com/HttpHandler-to-handle-all-kinds-of-URL-s-in-Mono-Apache-in-order-to-build-a-REST-service-td1752753.html

http://stackoverflow.com/questions/2569703/httphandler-to-handle-all-kinds-of-urls-in-mono-apache-xsp-in-order-to-build-a-r

http://lists.ximian.com/pipermail/mono-list/2005-June/027551.html

I hope this helps,
Atanas Korchev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Igor
Top achievements
Rank 2
answered on 12 Oct 2011, 11:40 AM
Thank you for answering, i found the things that were missed in my Mono configuration: 

mod_mono.conf:

AddType application/x-asp-net .axd
SetHandler mono

but unfortunately i did not get it working yet with compression and combine (even with XSP 4 web server).
i am looking for solution and will let you know if i found one.

the workaround now is to disable compression and combine for CSS and scripts.
0
Kevin
Top achievements
Rank 1
answered on 07 Jan 2012, 06:14 PM
Hello Igor, 

Did you find any solution in order to have Asset working with Mono ?

Thank you for your awnser
0
Igor
Top achievements
Rank 2
answered on 04 Mar 2012, 09:57 AM
Hi!

Unfortunately i didnt yet
I disabled all assets to work with Mono
0
Igor
Top achievements
Rank 2
answered on 29 Mar 2012, 11:11 PM
Hi guys!
Any progress on Mono handlers support?
0
Atanas Korchev
Telerik team
answered on 30 Mar 2012, 08:03 AM
Hi,

 Do you think there is a problem with Telerik Extensions for ASP.NET MVC which prevents the HTTP handlers from working in Mono? I think there is just a configuration issue which prevents them from working. Have you tried with other HTTP handlers? Do they work as expected in your setup?

Kind regards,
Atanas Korchev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Igor
Top achievements
Rank 2
answered on 31 Mar 2012, 04:03 PM
hi!

i have updated Telerik Extensions for MVC, Mono and mod_mono for Apache to the last versions and now everything works as expected. Not sure what the problem was exactly, but anyway now its fine!
0
Kevin
Top achievements
Rank 1
answered on 31 Mar 2012, 06:24 PM
Hello Igor, 

Thank You !!

Could you please tell me what is your configuration ?
Telerik Extensions for ASP.NET MVC Q1 2012 ?
Mono  2.6.10 ?
0
Igor
Top achievements
Rank 2
answered on 31 Mar 2012, 11:17 PM
Kevin,
i am using Q1 2012 of MVC Extensions and Mono 2.10.8
0
Kevin
Top achievements
Rank 1
answered on 01 Apr 2012, 10:10 PM
Coul you send me your current configuration about Asset HttpHandler you're using ?

Did you try with xsp4 server ?
0
Igor
Top achievements
Rank 2
answered on 08 Apr 2012, 06:15 PM
Kevin,
i did not try xsp4 so far, only apache2.
i am using default HttpHandler registration from Telerik MVC Website template's web.config 
0
Kevin
Top achievements
Rank 1
answered on 26 May 2012, 02:04 PM
Hello Igor, 

I installed mono 2.10.8 o my server and tried to activate asset combination support -> It doesn't work anyway.
I'm also using Telerik Q1 2012 MVC extensions...


Could you tell me if I forgot something in my configuration ?

This is my Web.config handler configuration : 

<httpHandlers>
      <add verb="GET,HEAD" path="asset.axd" validate="false" type="Telerik.Web.Mvc.WebAssetHttpHandler, Telerik.Web.Mvc" />
    </httpHandlers>

This is an extract of my virtual host configuration : 
<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName .....

        MonoPath default "/usr/lib/mono/4.0"
        MonoServerPath default /usr/bin/mod-mono-server4
        AddMonoApplications default "/:/..."

         <location />
                MonoSetServerAlias default
                AddType application/x-asp-net .axd
                SetHandler mono
                SetOutputFilter DEFLATE
                SetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png)$" no-gzip dont-vary
         </location>

        DocumentRoot /....
        <Directory /....>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride all
                Order allow,deny
                allow from all
        </Directory>

        ErrorLog /....

        <IfModule mod_deflate.c>
                AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript
        </IfModule>

</VirtualHost>

Thank you very much for helping me ...

Kevin, 

0
Igor
Top achievements
Rank 2
answered on 26 May 2012, 04:36 PM
Kevin, your configuration seems to be ok.
how did you install mono and mod_mono?
do you have mod-mono-server4 , libapache-mod-mono  installed and configured ?
and what exactly problem do you faced with - 404 or 500 server error? does the other part of the site works as expected?

show here also mod_mono.conf file please
0
Kevin
Top achievements
Rank 1
answered on 26 May 2012, 07:13 PM
Hello Igor, 

I've installed  mono and mod_mono from sources (with compiling)... So all I think all needed is installed (do you agree ?).

All my website works fine except for Telerik web asset -> 404 server error when I activate Telerik asset combination.

Here is my mod_mono.conf : 

# mod_mono.conf


# Achtung! This file may be overwritten
# Use 'include mod_mono.conf' from other configuration file
# to load mod_mono module.


<IfModule !mod_mono.c>
    LoadModule mono_module /usr/lib/apache2/modules/mod_mono.so
</IfModule>


<IfModule mod_headers.c>
    Header set X-Powered-By "Mono"
</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

Thenk you.
0
Igor
Top achievements
Rank 2
answered on 26 May 2012, 09:17 PM
Kevin, have you tried to test if http handlers works with your configuration?
Please try this example and see if it works: http://schwuk.com/articles/2005/02/25/using-httphandlers-with-mod_mono/ 

If you still have 404 - i recommend to install Mono from scratch using this script (for Debian):
# STEP 1 ...
 
echo 'deb http://ftp.debian.org/debian unstable main' >>/etc/apt/sources.list
echo 'deb http://ftp.debian.org/debian experimental main' >>/etc/apt/sources.list
 
apt-get update
apt-get upgrade -y --force-yes
 
# reboot system !!
reboot
 
# STEP 2
 
# we may have wrong gcc version updated...
apt-get remove -y gcc-4.4
apt-get install -y --force-yes gcc-4.4
 
 
 
apt-get -y --force-yes -t unstable install libpcre3
apt-get -y --force-yes -t experimental install libglib2.0-0 mono-devel mono-complete
 
/etc/init.d/apache2 stop
 
apt-get -y --force-yes -t experimental install mono-apache-server
apt-get -y --force-yes -t experimental install libapache2-mod-mono
 
service apache2 restart
 
#REBOOT AGAIN
reboot

By the way.. After updating the system (and moving to debian...) i got error with Telerik MVC Extensions 2012.1.419 asset handler again. It can be reproduced with default settings on mono 2.10:

when opening URL: 
http://localhost/asset.axd?id=kQAAAB-LCAAAAAAAAANVjcEKwjAQRP9lziFtahXM1c-QntItFE1WkrUIJf_ukh7E28x7A7Njhr_veMHjxkkoCQyWxpIyoSfl9WEDx8jJhlJUM3xfzf8gkmT-eVenOhkEaZOPdIfZtA69G6yzo7sqCHp_upw1wEt-U_0CNhxLipEAAAA%3d

i got 500 server error (not 404 !)

System.NullReferenceException: Object reference not set to an instance of an object
  at System.Web.Script.Serialization.JavaScriptSerializer.ConvertToObject (IDictionary`2 dict, System.Type type) [0x00000] in <filename unknown>:0 
  at System.Web.Script.Serialization.JavaScriptSerializer.ConvertToType (System.Type type, System.Object obj) [0x00000] in <filename unknown>:0 
  at System.Web.Script.Serialization.JavaScriptSerializer.ConvertToList (System.Collections.ArrayList col, System.Type type) [0x00000] in <filename unknown>:0 
  at System.Web.Script.Serialization.JavaScriptSerializer.ConvertToType (System.Type type, System.Object obj) [0x00000] in <filename unknown>:0 
  at System.Web.Script.Serialization.JavaScriptSerializer.ConvertToObject (IDictionary`2 dict, System.Type type) [0x00000] in <filename unknown>:0 
  at System.Web.Script.Serialization.JavaScriptSerializer.ConvertToType (System.Type type, System.Object obj) [0x00000] in <filename unknown>:0 
  at System.Web.Script.Serialization.JavaScriptSerializer.ConvertToList (System.Collections.ArrayList col, System.Type type) [0x00000] in <filename unknown>:0 
  at System.Web.Script.Serialization.JavaScriptSerializer.ConvertToType (System.Type type, System.Object obj) [0x00000] in <filename unknown>:0 
  at System.Web.Script.Serialization.JavaScriptSerializer.ConvertToType[IEnumerable`1] (System.Object obj) [0x00000] in <filename unknown>:0 
  at Telerik.Web.Mvc.Infrastructure.Implementation.WebAssetGroupConverter.SetIfPresent[IEnumerable`1] (IDictionary`2 dictionary, System.String key, System.Action`1 setter) [0x00000] in <filename unknown>:0 
  at Telerik.Web.Mvc.Infrastructure.Implementation.WebAssetGroupConverter.Deserialize (IDictionary`2 dictionary, System.Type type, System.Web.Script.Serialization.JavaScriptSerializer serializer) [0x00000] in <filename unknown>:0 
  at System.Web.Script.Serialization.JavaScriptSerializer.ConvertToType (System.Type type, System.Object obj) [0x00000] in <filename unknown>:0 
  at System.Web.Script.Serialization.JavaScriptSerializer.ConvertToType[WebAssetGroup] (System.Object obj) [0x00000] in <filename unknown>:0 
  at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize[WebAssetGroup] (System.String input) [0x00000] in <filename unknown>:0 
  at Telerik.Web.Mvc.Infrastructure.Implementation.WebAssetGroupSerializer.Deserialize (System.String source) [0x00000] in <filename unknown>:0 
  at Telerik.Web.Mvc.WebAssetHttpHandler.ProcessRequest (System.Web.HttpContextBase context) [0x00000] in <filename unknown>:0 
  at Telerik.Web.Mvc.Infrastructure.HttpHandlerBase.ProcessRequest (System.Web.HttpContext context) [0x00000] in <filename unknown>:0 
  at System.Web.HttpApplication+<Pipeline>c__Iterator6.MoveNext () [0x00000] in <filename unknown>:0 
  at System.Web.HttpApplication.Tick () [0x00000] in <filename unknown>:0 

Anyway it used to work normally on Ubuntu server before...

I suspect the problem is related to the JavaScriptSerializer implementation in Mono, so i recommend few things:
0
Igor
Top achievements
Rank 2
answered on 26 May 2012, 09:20 PM
I am looking forward to find any solution fixing JavaScriptSerializer issue..
Tags
General Discussions
Asked by
Igor
Top achievements
Rank 2
Answers by
Atanas Korchev
Telerik team
Igor
Top achievements
Rank 2
Kevin
Top achievements
Rank 1
Share this question
or