Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Zakhar 171 posts 397 karma points
    Jun 08, 2011 @ 11:44
    Zakhar
    0

    Umbraco 4.7 conflicting with NHibernate?

    Hi everyone,

    We use NHibernate in our site and it works fine with Umbraco 4.5.2 and .NET 2. Now I want to upgrade to Umbraco 4.7 and .NET Framework 4. 

    I installed fresh instance of Umbraco with existing database and added my site to it. Everything seems to work alright but Xslt. They do not work at all, in developer section if I click visualize xslt I get page broken error in popup window and this error in my log:

    A potentially dangerous Request.Form value was detected from the client (ctl00$body$xsltSelection="<?xml version="1.0" ...").The error occured at System.Web because    at System.Web.HttpRequest.ValidateString(String value, String collectionKey, RequestValidationSource requestCollection)
       at System.Web.HttpRequest.ValidateNameValueCollection(NameValueCollection nvc, RequestValidationSource requestCollection)
       at System.Web.HttpRequest.get_Form()
       at System.Web.HttpRequest.get_HasForm()
       at System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull)
       at System.Web.UI.Page.DeterminePostBackMode()
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
       at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
       at System.Web.UI.Page.ProcessRequest()
       at System.Web.UI.Page.ProcessRequest(HttpContext context)
       at ASP.umbraco_developer_xslt_xsltvisualize_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\2207c7d7\2bea5e3d\App_Web_xsltvisualize.aspx.4c11830c.k3vdfgfc.0.cs:line 0
       at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

    If I try to create new xslt I get the same page broken in popup and this error in umbracoLog table:

    At /umbraco/create.aspx?nodeId=init&nodeType=initxslt&nodeName=XSLT%20Files&rnd=97.7&rndo=98.4 (Referred by: http://localhost:40/umbraco/create.aspx?nodeId=init&nodeType=initxslt&nodeName=XSLT Files&rnd=97.7&rndo=98.4): System.Exception: Unable to load one or more of the types in assembly 'NHibernate.Search, Version=2.0.0.1001, Culture=neutral, PublicKeyToken=b02813437f591915'. Exceptions were thrown: System.IO.FileLoadException: Could not load file or assembly 'Lucene.Net, Version=2.3.1.3, Culture=neutral, PublicKeyToken=45b1dda587cdc860' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) System.IO.FileLoadException: Could not load file or assembly 'Lucene.Net, Version=2.3.1.3, Culture=neutral, PublicKeyToken=45b1dda587cdc860' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) System.IO.FileLoadException: Could not load file or assembly 'Lucene.Net, Version=2.3.1.3, Culture=neutral, PublicKeyToken=45b1dda587cdc860' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)     at umbraco.BusinessLogic.Utils.TypeFinder.FindClassesMarkedWithAttribute(Assembly assembly, Type attribute)     at umbraco.BusinessLogic.Utils.TypeFinder.FindClassesMarkedWithAttribute(Type attribute)     at umbraco.macro.GetXsltExtensionsImpl()     at umbraco.cms.businesslogic.cache.Cache.GetCacheItem[TT](String cacheKey, Object syncLock, CacheItemPriority priority, CacheItemRemovedCallback refreshAction, CacheDependency cacheDependency, TimeSpan timeout, GetCacheItemDelegate`1 getCacheItem)     at umbraco.macro.GetXsltExtensions()     at umbraco.macro.AddXsltExtensionsToHeader(String xslt)     at umbraco.XsltTasks.Save()     at umbraco.presentation.create.dialogHandler_temp.Create(String NodeType, Int32 TypeId, Int32 NodeId, String Text)     at umbraco.presentation.create.xslt.sbmt_Click(Object sender, EventArgs e)     at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    I can see that Umbraco uses Lucene.Net and I guess NHibernate uses the same library and they conflicting somehow. Can I do anything about it?

    Thanks

  • Drew 165 posts 340 karma points
    Jun 10, 2011 @ 12:41
    Drew
    0

    NHibernate can be a pain to debug (I used it for 3 years). If you've  not already used it, set up the NHiberate Profiler (30 day trial).
    It's very easy, all you do is turn on logging in the NHibernate config section of your Web.config and then set up a Log4Net config file with a TCP/IP Log4Net listener, or simply leave it log to a file normally - theres full instructions on Ayende' site.
    http://nhprof.com/

    If you use the profiler, you can see the logged statements and SQL queries as they happen.

    You can also just look at the logs generated using one of the many log readers, the best so far that I've found is:
    http://yourlog4netviewer.codeplex.com/

    But I REALLY recommend that you use the NHibernate Profiler, it's saved me days of 'wading through debug files'. And its also helpful as an actual profiling tool to tweak your NHIbernate configs/relationships :)

     

    Guesswork

    Do you have components that use NHibernate *within* your 4.5.2 Umbraco installation - do they share the same IIS website instance?

    If so, then you may find that your NHibernate settings in your NHibernate config section of the web.config is conflicting as the values may be inherited from any previous web.configs.

    This may help:  http://am22tech.com/s/22/FORUM1/default.aspx?g=posts&m=2

    Bit of a guess as well - but could it be that the Umbraco NHib session factory and your own session factory are using the same name (or, both have no name set, therefore conflicting).
    e.g. <hibernate-configuration xmlns="urn:nhibernate-configuration-2.0" > <session-factory name="mySessionFactoryNameHere"/>

     

     

    Good luck!

     

     

     



  • James Drever 118 posts 149 karma points
    Aug 02, 2011 @ 11:21
    James Drever
    0

    Hi, wondering if anyone got this sorted.  I would be really keen to be able to use a current version of nHibernate alongside Umbraco, but I had similiar problems to the above (XLST not working) when I tried it.  The issue is that Umbraco has its own dependencies on nHibernate (I know Courier 2 uses it) - which means unless there is some mechanism to allow multiple nHibernate installs in the same instance, you are tied to using whatever nHibernate version Umbraco needs (currently 2.2).

    Really do want an ORM in place for my own bespoke code running alongside Umbraco, but currently looking into Entity Framework because I won't have these dependency issues.

    Thanks,

    James.

     

     

Please Sign in or register to post replies

Write your reply to:

Draft