Copied to clipboard

Flag this post as spam?

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


  • David Armitage 505 posts 2073 karma points
    Sep 30, 2016 @ 05:42
    David Armitage
    0

    Random BUG - Partial View / Controller Error when updating files in the App_code Folder

    Hi,

    I have encountered this a number of times and its very annoying. Sometimes in my live environment if I update some files (usually files in the App_Code folder) following the updates I get Partial View Errors.

    This seems to happened when I change files that require the site to re-build. Its as if it isn't rebuilding something correctly.

    Please see the attachment...

    enter image description here

    Actually there is nothing wrong with the code and the issue doesn't exist within the controller or anything. If I pull the whole project locally it works fine. This is what makes this very frustrating.

    I always manage to fix this but it sometimes takes me 30/40 mins everything which is unacceptable since I am only trying to deploy small / quick changes to production sites.

    From memory I think I sometimes manage to fix this by editing the web.config so it forces a rebuild. This is very rare though. usually I have to delete the whole website and re-deploy the entire site.

    I really want to understand what is going on here and why. And more importantly if there is a quicker fix other than re-deploying the whole website.

    Kind Regards

    David

  • Steve Morgan 1346 posts 4453 karma points c-trib
    Oct 03, 2016 @ 08:43
    Steve Morgan
    0

    Are you possibly overwriting the umbraco.config file? This is the Umbraco XML cache - if you have this in source control / your release packages it will cause issues which are "weird" until you republish the entire site as you're basically copying your cache from a dev machine over live.

    Also ensure you're not pushing anything from /AppData/cache /AppData/temp

    HTH

    Steve

  • David Armitage 505 posts 2073 karma points
    Oct 10, 2016 @ 08:23
    David Armitage
    0

    Hey Steve,

    Just experiencing the same problem with another client site. Took me a few hours to fix up.

    I think it is defiantly something to do with the Cache / Config. Still not tracked down an exact fix though. The only thing I can do to get it working is do a full re-deployment.

    I tried..

    1. Republishing

    2. Deleting various things form the App_Data folder (cache / temp) etc.

    Not much worked. I just have a quick question regarding the correct was to deploy Umbraco websites to a live environment.

    When moving a site from dev to live (fresh full deployment) should we be deleting the Cache / Temp folders and also deleting the Umbraco.Config

    I know the cache and temp get auto generated but is the the same for the config file. In addition to these what other folders or files should I be leaving out of the deployments.

    Its probably my deployment process whats confusing Umbraco. Hopefully if I improve this I will stop encountering these issues which are a massive pain to fix up.

  • David Armitage 505 posts 2073 karma points
    Oct 03, 2016 @ 09:57
    David Armitage
    0

    Hi Steve,

    No its defiantly not that. This usually happens when I overwrite custom classes I have created.

    Within App_Code I have....

    1. Models which I use to build a custom form eg ContactFormModel.cs this stores all the form fields and the data annotation validation stuff. Nothing special.

    2. I have 1 surfacecontroller that handles all the form logic. Again nothing special. Just get and post functions for my partial views.

    I usually encounter this problem when a client asks for a new field adding to their form or something change like adding some extra validation to the model class.

    In any case 3 files usually get updated.

    1. The model (form fields, validation logic etc)

    2. The controller to handle what goes on with the new fields when posted.

    3. The partial view form (add the new field or whatever)

    Once the change are made I literally overwrite these 3 files (nothing else) on the production server. On refresh of the browser on the production site I can see its takes a while since it is rebuilding. I am then presented with the error.

    You may be on the right track though before I think I may have fixed this by re-publishing the whole site.

    I have come across a few different re-publish methods. Which one do you think is the most likely fix??? XML or the Preview?

    http://YOURDOMAIN/Umbraco/dialogs/republish.aspx?xml=true http://YOURDOMAIN/Umbraco/dialogs/republish.aspx?previews=true

  • Steve Morgan 1346 posts 4453 karma points c-trib
    Oct 03, 2016 @ 10:11
    Steve Morgan
    0

    My understanding is the first link will rebuild the xml cache which then triggers a refresh of the in-memory cache.

    The latter link is just (I think!) for the editor previews in the Umbraco backend.

    Those links are a bit legacy - you should just be able to right click on the content (the grey text at the top of the content tree) and select republish site.

    It does look a bit like the model has been cached without your new field and is being passed to the controller and then it's throwing a wobbly. Are you using cached partial or anything like that in the views? Seems odd.

    Steve

  • David Armitage 505 posts 2073 karma points
    Oct 03, 2016 @ 10:21
    David Armitage
    0

    Hey Steve,

    Not that I know of. I haven't enabled caching or anything on the partial view unless this is enabled by default.

    I really don't think it is enabled though. I think I would have noticed. I am coding these forms on a daily basis and never noticed any caching happening.

    It does seem a strange issue that's why I thought I would check if anyone else was experiencing similar issues.

    I must say though I really only noticed this is the later versions of Umbraco. I just checked one of the sites this happens on often.

    Umbraco version 7.1.8 assembly: 1.0.5394.16131 - this is probably the oldest version I think I can remembering it happening on.

    The issues has pulled through to the latest release though as I am experiencing it on my more recent projects.

    I will keep an eye on it and document what seems to fix it the next time around.

Please Sign in or register to post replies

Write your reply to:

Draft