Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

GZIP and MVC 4
prologic
#1 Posted : Sunday, January 27, 2013 8:18:10 PM(UTC)
Groups: Member
Joined: 1/27/2013(UTC)
Posts: 3

Hi,

Firstly I'd like to thank the devs for making an awesome easy to use product.

I seem to have run into a bit of an odd behavior with the server sending JS and CSS GZIP encoded, and the *.cshtml / Razon generated pages sending them uncompressed. Is there something obvious I'm missing?

For example

Request URL:http://mywebsite:81/mis/Item/Edit/5511b005-b803-46eb-8bab-0b16931ba1ac
Request Method:GET
Status Code:200 OK

Request Headers

Accept:text/html, */*; q=0.01
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
DNT:1
Host:mywebsite:81
Referer:http://mywebsite:81/mis/Item
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.56 Safari/537.17
X-Requested-With:XMLHttpRequest

Response Headers

Cache-Control:private
Content-Length:2549
Content-Type:text/html; charset=utf-8
Date:Mon, 28 Jan 2013 01:08:22 GMT
Server:UltiDev Web Server Pro (3.0.0.18) Microsoft-HTTPAPI/2.0
X-AspNet-Version:4.0.30319
X-AspNetMvc-Version:4.0
Ultidev Team
#2 Posted : Sunday, January 27, 2013 9:49:39 PM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,253

Thanks: 28 times
Was thanked: 60 time(s) in 59 post(s)
Hi there!

Thank you much for the positive feedback.

MVC compresses some responses in the application - before they are delegated to our web server to be sent to the client. It seems that MVC compresses in-the-application things that it serves from assembly resources. Stand-alone files, like jQuery JS, your own CSS, Razor views, etc. are not compressed in-application unless they are minified using MVC bundling feature.

To work around this behavior you may simply turn on response compression in UWS as shows on the attached screenshot. It will make UWS compress uncompressed responses, and pass through those that already have GZIP as response encoding.

Please let us know if this information was helpful.

Best regards,
UltiDev Team.
Ultidev Team attached the following image(s):
Ultidev Team attached the following image(s): UWS compression settings.PNG
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
prologic
#3 Posted : Sunday, January 27, 2013 10:41:37 PM(UTC)
Groups: Member
Joined: 1/27/2013(UTC)
Posts: 3

Hi,

Thanks for the fast answer.

That checkbox is selected, but the *.cshtml is not returned compressed. JS and CSS is.

Edit: Should I enable compression via the Web.config?

Edit2: Actually, it could be the pages I'm serving are under GZIP minimum size. What's that in UltiDev?
Ultidev Team
#4 Posted : Monday, January 28, 2013 9:53:17 AM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,253

Thanks: 28 times
Was thanked: 60 time(s) in 59 post(s)
Hi!

Minimum response size for UWS to attempt compression is 4KB. UWS also abandons compression attempt if it finds that compression ratio is somewhat low, like if response compressed by only 30% or less.

Changing settings in web.config won't change UWS behavior, but it may change application behavior. UWS is not using IIS7 web.config config sections. UWS is more like IIS6 - it's unaware of web.config settings.

Please try to place a .txt file larger than 4KB in the root of your app, and browse to is. See what Fiddler tells you about the file being compressed.

Please let us know what you found.

Best regards,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
prologic
#5 Posted : Wednesday, January 30, 2013 5:40:34 AM(UTC)
Groups: Member
Joined: 1/27/2013(UTC)
Posts: 3

Hi,

Just tested it. When the *.cshtml file exceeds 4KB in size it does in fact get GZIPed.

False alarm on my part.

Thanks for the tip :)

Ultidev Team
#6 Posted : Thursday, January 31, 2013 6:07:51 PM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,253

Thanks: 28 times
Was thanked: 60 time(s) in 59 post(s)
Thank you much!

All the best wishes,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
Rss Feed  Atom Feed
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.