Disable Optimization

Dec 30, 2012 at 6:58 PM

Hi!

How can I disable the optimization during the compilation of the web project in visual Studion 2010?

Thank you for the answers!

KU

Coordinator
Jan 2, 2013 at 2:42 PM

There is nothing to disable during compilation - optimization is basically a DLL called by application at runtime when someone requests particular URL. You can disable optimization in admin/settings/advanced (or manually making change to app_data/configuration.xml) - this will replace specific optimized URL with normal JS/CSS URLs then optimization DLL will never be called.

Jan 4, 2013 at 9:05 PM
Edited Jan 4, 2013 at 9:29 PM

Hi rtur!

I disabled the optimization on my ubuntu server, using the settings.xml <enableoptimization> tag but I still got the following exception:

Ooops! An unexpected error has occurred.

This one's down to me! Please accept my apologies for this - I'll see to itthat the developer responsible for this happening is given 20 lashes (but only after he or she has fixed this problem).
Error Details:

Url : http://xxxxxx/blog/admin/Settings/Main.aspx

Raw Url : /blog/admin/Settings/Main.aspx

Message : Exception of type 'System.Web.HttpUnhandledException' was thrown.

Source : System.Web

StackTrace : at System.Web.UI.Page.ProcessException (System.Exception e) [0x00000] in :0

at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context) [0x00000] in :0

at System.Web.HttpApplication+c__Iterator6.MoveNext () [0x00000] in :0

at System.Web.HttpApplication.Tick () [0x00000] in :0

TargetSite : Void ProcessException(System.Exception)

Message : Method not found: 'System.Security.Cryptography.CryptoConfig.get_AllowOnlyFipsAlgorithms'.

Source : System.Web.Optimization

StackTrace : at System.Web.Optimization.Bundle.GetContentHashCode (System.Web.Optimization.BundleContext context) [0x00000] in :0

at System.Web.Optimization.Bundle.GetBundleUrl (System.Web.Optimization.BundleContext context, Boolean includeContentHash) [0x00000] in :0

at System.Web.Optimization.BundleCollection.ResolveBundleUrl (System.String bundleVirtualPath, Boolean includeContentHash) [0x00000] in :0

at System.Web.Optimization.BundleCollection.ResolveBundleUrl (System.String bundleVirtualPath) [0x00000] in :0

at ASP.admin_admin_master.__DataBind__bctrl_43 (System.Object sender, System.EventArgs e) [0x00000] in :0

at System.Web.UI.Control.OnDataBinding (System.EventArgs e) [0x00000] in :0

at System.Web.UI.Control.DataBind (Boolean raiseOnDataBinding) [0x00000] in :0

at System.Web.UI.Control.DataBind () [0x00000] in :0

at System.Web.UI.Control.DataBindChildren () [0x00000] in :0

at System.Web.UI.Control.DataBind (Boolean raiseOnDataBinding) [0x00000] in :0

at System.Web.UI.Control.DataBind () [0x00000] in :0

at Admin.AdminMasterPage.OnInit (System.EventArgs e) [0x00000] in :0

at System.Web.UI.Control.InitRecursive (System.Web.UI.Control namingContainer) [0x00000] in :0

at System.Web.UI.Control.InitRecursive (System.Web.UI.Control namingContainer) [0x00000] in :0

at System.Web.UI.Page.InternalProcessRequest () [0x00000] in :0

at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context) [0x00000] in :0

TargetSite : System.String GetContentHashCode(System.Web.Optimization.BundleContext)

Do you know what is the source of this problem?

Thanks,

KU

Coordinator
Jan 7, 2013 at 6:53 PM

When do you get this exception? I have no idea what you doing exactly - trying to compile project and it fails or deployed it to the server and getting error while loading the page etc.

Jan 9, 2013 at 1:05 PM

Hi rtur,

Sorry, I try to summarize things a bit. First of all, my goal is to get Blogengine 2.7 run on my Ubuntu 12.04 Server under Mono environment using Apache mod_mono. Unfortunately I encountered issues during the tryouts.

1. I get the Blogengine.Web source on my Ubuntu desktop system, and compiled it with MonoDevelop. The compilation was successful so I deployed the BE to my server. During the first start, of the blog I always got exception, so the blog site did not appear. I created an issue here about it (http://blogengineweb.codeplex.com/workitem/3).

2. I had an idea to try a "cross-compile" deployment. In that case, I compiled Blogengine.Web source on Windows using VS 2010, and deployed it to the server. When I opened the page, I had a "registry-based" quick exception at start, but after refreshing the page the blog site appeared in the browser. I can login to the blog with admin, but when I try for example accessing the Posts page I get the exception above. I disabled the optimization based on your advice, but nothing changed. Here I have to mention that when I access the "Welcome to BlogEngine.NET 2.7" the page not display correctly. And when I try to access the "Dashboard" not a page returns but a "default.cshtml" file, which my browser wants to download.

These are my current problems with the BE on Ubuntu.

Thank you for your help!

KU

Coordinator
Jan 10, 2013 at 6:12 PM

BE 2.7 uses Web Pages (Razor .cshtml file) along with WebForms (regular .aspx files). Here is thread discussing same issue as yours. Also here.

Jan 12, 2013 at 12:00 AM
Edited Jan 12, 2013 at 12:02 AM

Dear rtur,

The MCV3 razor issues have solved based on your suggestion, but the optimization.dll is still CALLED.

I figured out that when I build the Blogengine.Web and run it on Mono the reason why I get exception (http://blogengineweb.codeplex.com/workitem/2) is that the Optimization.dll is missing from the BE.WEB source!

If I copy the dll to the bin folder the blog site is working. But of course because the Optimization is not implemented in mono, I get the exception above when I click for example the Blogs on the administration widget. Here is the test blog's settings.xml:

 

<?xml version="1.0" encoding="utf-8"?>

<settings>

  <displayratingsonrecentposts>True</displayratingsonrecentposts>

  <authorname>My name</authorname>

  <email>name@example.com</email>

  <mobiletheme>JQ-Mobile</mobiletheme>

  <postsperpage>10</postsperpage>

  <htmlheader />

  <contactthankmessage><h1>Thank you</h1><p>The message was sent.</p></contactthankmessage>

  <emailsubjectprefix>Weblog</emailsubjectprefix>

  <trackingscript />

  <showdescriptioninpostlist>False</showdescriptioninpostlist>

  <commentsperpage>10</commentsperpage>

  <enablepingbacksend>True</enablepingbacksend>

  <showdescriptioninpostlistforpostsbytagorcategory>False</showdescriptioninpostlistforpostsbytagorcategory>

  <commentblacklistcount>2</commentblacklistcount>

  <removeextensionsfromurls>True</removeextensionsfromurls>

  <iscocommentenabled>False</iscocommentenabled>

  <compresswebresource>False</compresswebresource>

  <addiptowhitelistfilteronapproval>False</addiptowhitelistfilteronapproval>

  <themecookiename>theme</themecookiename>

  <trustauthenticatedusers>True</trustauthenticatedusers>

  <enablecountryincomments>True</enablecountryincomments>

  <contactformmessage><p>I'll answer the mail as soon as I can.</p></contactformmessage>

  <searchbuttontext>Search</searchbuttontext>

  <showincludecommentsoption>False</showincludecommentsoption>

  <israzortheme>False</israzortheme>

  <enablewebsiteincomments>False</enablewebsiteincomments>

  <enablecontactattachments>True</enablecontactattachments>

  <blogrollmaxlength>23</blogrollmaxlength>

  <postsperfeed>10</postsperfeed>

  <searchdefaulttext>Enter search term or APML url</searchdefaulttext>

  <language>en-US</language>

  <smtpserver>mail.example.com</smtpserver>

  <disqusdevmode>False</disqusdevmode>

  <showpostnavigation>True</showpostnavigation>

  <displaycommentsonrecentposts>True</displaycommentsonrecentposts>

  <enabletrackbackreceive>True</enabletrackbackreceive>

  <enableopensearch>True</enableopensearch>

  <dayscommentsareenabled>0</dayscommentsareenabled>

  <useblognameinpagetitles>True</useblognameinpagetitles>

  <enabletrackbacksend>True</enabletrackbacksend>

  <smtpusername>username</smtpusername>

  <enableerrorlogging>True</enableerrorlogging>

  <enablehttpcompression>False</enablehttpcompression>

  <enablepasswordreset>True</enablepasswordreset>

  <disqusaddcommentstopages>False</disqusaddcommentstopages>

  <alternatefeedurl />

  <enablecommentsmoderation>True</enablecommentsmoderation>

  <feedauthor />

  <timezone>0</timezone>

  <allowservertodownloadremotefiles>True</allowservertodownloadremotefiles>

  <culture>Auto</culture>

  <disquswebsitename />

  <handlewwwsubdomain />

  <theme>Standard</theme>

  <sendmailoncomment>True</sendmailoncomment>

  <description>Short description of the blog</description>

  <blogrollvisibleposts>3</blogrollvisibleposts>

  <geocodinglatitude>0</geocodinglatitude>

  <numberofreferrerdays>1</numberofreferrerdays>

  <thumbnailserviceapi />

  <iscommentsenabled>True</iscommentsenabled>

  <syndicationformat>Rss</syndicationformat>

  <smtpserverport>25</smtpserverport>

  <blockauthoroncommentdelete>False</blockauthoroncommentdelete>

  <iscommentnestingenabled>True</iscommentnestingenabled>

  <timestamppostlinks>True</timestamppostlinks>

  <enablereferrertracking>False</enablereferrertracking>

  <avatar>wavatar</avatar>

  <smtppassword>password</smtppassword>

  <numberofrecentcomments>10</numberofrecentcomments>

  <enablerecaptchaoncontactform>False</enablerecaptchaoncontactform>

  <enableoptimization>False</enableoptimization>

  <name>Name of the blog</name>

  <moderationtype>Auto</moderationtype>

  <enablepingbackreceive>True</enablepingbackreceive>

  <showlivepreview>True</showlivepreview>

  <enablequicknotes>True</enablequicknotes>

  <galleryfeedurl>http://dnbegallery.org/feed/FeedService.svc</galleryfeedurl>

  <remotemaxfilesize>524288</remotemaxfilesize>

  <enablerelatedposts>True</enablerelatedposts>

  <remotefiledownloadtimeout>30000</remotefiledownloadtimeout>

  <enableenclosures>False</enableenclosures>

  <endorsement>http://www.dotnetblogengine.net/syndication.axd</endorsement>

  <removewhitespaceinstylesheets>True</removewhitespaceinstylesheets>

  <commentwhitelistcount>1</commentwhitelistcount>

  <descriptioncharacters>300</descriptioncharacters>

  <addiptoblacklistfilteronrejection>False</addiptoblacklistfilteronrejection>

  <enablessl>False</enablessl>

  <descriptioncharactersforpostsbytagorcategory>0</descriptioncharactersforpostsbytagorcategory>

  <commentreportmistakes>False</commentreportmistakes>

  <searchcommentlabeltext>Include comments in search</searchcommentlabeltext>

  <numberofrecentposts>10</numberofrecentposts>

  <geocodinglongitude>0</geocodinglongitude>

  <selfregistrationinitialrole>Select</selfregistrationinitialrole>

  <enableselfregistration>False</enableselfregistration>

  <blogrollupdateminutes>60</blogrollupdateminutes>

  <securityvalidationkey>07a256ce58c34502b88a3685041f22ef0aaedeb5b81a42cbbe7a5cf5746206a3f8db69c6342a4bedbe19680eac87d970</securityvalidationkey>

  <requiresslmetaweblogapi>False</requiresslmetaweblogapi>

  <enablerating>True</enablerating>

  <enablecommentsearch>True</enablecommentsearch>

</settings>

 

It seems that the optimization is disabled, but why is it still called?

Thank you for the answers,

KU

Coordinator
Jan 14, 2013 at 7:44 PM

To clarify - you built project and moved it to the server, but you getting errors trying to access app in the browser, right?

Can you see any pages at all or it is some specific pages where you get error?

You do need DLL because it is referenced. Worse case you would need to remove any "Import Namespace=System.Web.Optimization" in master pages along with conditions where optimization turned on/off and then re-compile. For example, from:

<% if (BlogSettings.Instance.EnableOptimization) { %>
    <link href="<%# BundleTable.Bundles.ResolveBundleUrl("~/admin/css")%>" rel="stylesheet" type="text/css" />
<% } else { %>
    <link href="~/admin/style.css" rel="stylesheet" type="text/css" />
    <link href="~/admin/colorbox.css" rel="stylesheet" type="text/css" />
    <link href="~/admin/tipsy.css" rel="stylesheet" type="text/css" />  
<% } %>
to:

<link href="~/admin/style.css" rel="stylesheet" type="text/css" />
<link href="~/admin/colorbox.css" rel="stylesheet" type="text/css" />
<link href="~/admin/tipsy.css" rel="stylesheet" type="text/css" /> 

Jan 14, 2013 at 8:29 PM

Wow, it seems that making these changes in the admin.master page solves the problem.

For the clarification, before applying this, I got the error when I tried to navigate on the Administration widget, so yes I saw the Welcome page, I could log in with Admin to the Blog site. But when I tried to access pages like Blogs, Pages, Comments I got the exception.

Could you fix this permanently on the BE source?

I appreciate your help for the suggestions!

Thank you for you time, and your help!

KU