Error in Website while opening my connection

3 posts, 1 answers
  1. Bernd
    Bernd avatar
    53 posts
    Member since:
    Feb 2013

    Posted 26 Jun 2013 Link to this post

    Hello all.
    I use the recommended way to manage the OpenAccess context. In Visual Studio it works fine. Deploying it I get this ugly message:

    Event handlers can only be bound to HttpApplication events during IHttpModule initialization

    "<validation validateIntegratedModeConfiguration="false" />" is set in web.config as suggested here.

    I don't think it has to do with ORM, but I hope someone here can give me a hint where to look.

    Thanks in advance
    Bernd

    My code to manage the context:
    public class ContextFactory
    {
        public static DispatcherEntities GetContextPerRequest()
        {
            HttpContext httpContext = HttpContext.Current;
            if (httpContext == null)
                return new DispatcherEntities();
            else
            {
                httpContext.ApplicationInstance.EndRequest += new System.EventHandler(ContextFactory.ApplicationInstance_EndRequest);
                int contextID = Thread.CurrentContext.ContextID;
                int hashCode = httpContext.GetHashCode();
                string key = string.Concat(hashCode, contextID);
                DispatcherEntities context = httpContext.Items[key] as DispatcherEntities;
                if (context == null)
                {
                    context = new DispatcherEntities();
                    httpContext.Items[key] = context;
                }
                return context;
            }
        }
     
        private static void ApplicationInstance_EndRequest(object sender, EventArgs e)
        {
            DispatcherEntities context = ContextFactory.GetContextPerRequest();
            if (context != null)
            {
                context.Dispose();
            }
        }
    }
  2. Answer
    Dimitar Tachev
    Admin
    Dimitar Tachev avatar
    67 posts

    Posted 28 Jun 2013 Link to this post

    Hi Bernd,

     
    I suppose that this error is caused by a different version of the IIS on your server compared with the one on your local machine.

    Discussing some possible issues like the one that you have described we decided to remove the HTTPModule approach from our recommended ones.

    In order to make sure that you will not have any further issues managing your OpenAccessContext I suggest you choose one of our actual recommended approaches described in this documentation section. I believe that the one which is using the HttpContext will be most similar to the one that you have already implemented.

    I hope this is applicable for you. Do not hesitate to contact us back if you need any further assistance.

    Regards,
    Dimitar Tachev
    Telerik
    OpenAccess ORM Q2 2013 brings you a more powerful code generation and a unique Bulk Operations support with LINQ syntax. Check out the list of new functionality and improvementsshipped with this release.

  3. DevCraft banner
  4. Bernd
    Bernd avatar
    53 posts
    Member since:
    Feb 2013

    Posted 29 Jun 2013 Link to this post

    Hi Dimitar.

    This solved my problem. Thanks for your support.
    Bernd
Back to Top