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)) %><% 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>....<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
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
Atanas Korchev
the Telerik team
mod_mono.conf:
AddType application/x-asp-net .axdSetHandler monobut 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.
Did you find any solution in order to have Asset working with Mono ?
Thank you for your awnser
Unfortunately i didnt yet
I disabled all assets to work with Mono
Any progress on Mono handlers support?
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
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!
Thank You !!
Could you please tell me what is your configuration ?
Telerik Extensions for ASP.NET MVC Q1 2012 ?
Mono 2.6.10 ?
i am using Q1 2012 of MVC Extensions and Mono 2.10.8
Did you try with xsp4 server ?
i did not try xsp4 so far, only apache2.
i am using default HttpHandler registration from Telerik MVC Website template's web.config
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>
<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,
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
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
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.listecho 'deb http://ftp.debian.org/debian experimental main' >>/etc/apt/sources.listapt-get updateapt-get upgrade -y --force-yes# reboot system !!reboot# STEP 2# we may have wrong gcc version updated...apt-get remove -y gcc-4.4apt-get install -y --force-yes gcc-4.4apt-get -y --force-yes -t unstable install libpcre3apt-get -y --force-yes -t experimental install libglib2.0-0 mono-devel mono-complete/etc/init.d/apache2 stopapt-get -y --force-yes -t experimental install mono-apache-serverapt-get -y --force-yes -t experimental install libapache2-mod-monoservice apache2 restart#REBOOT AGAINrebootBy 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:
- turn off asset.axd
- configure mod_mono using this tool: http://www.go-mono.com/config-mod-mono/
- enable mod_deflate, so apache itself will compress the content