Copied to clipboard

Flag this post as spam?

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


  • Adam Avenant 1 post 21 karma points
    Feb 09, 2015 @ 12:38
    Adam Avenant
    0

    Console Application and Umbraco.config

    I have written a Windows service that takes files as input and generates (and saves) media items in Umbraco linked to those files. Part of the process involves retrieving definitions stored as content to govern where to put the media item e.g. files with PDF extensions go here and have these properties assigned, files GIF or PNG extensions go there and have those properties assigned.

    The Umbraco integration is performed using Morten's console application example as a basis: https://github.com/sitereactor/umbraco-console-example. The version of Umbraco is v6.2.1

    While debugging recently I came across an issue on my dev box where a call to retrieve content contained really old definitions. Some investigation revealed that an App_Data folder had been created in the solution folder with an Umbraco.config file in it as well as some other temp data. The umbraco.config file contained the old content that was being returned. Deleting umbraco.config and re-running the solution appears to have recreated the umbraco.config file and the correct content is returned.

    Interestingly, the App_Data folder is on the same level as the bin folder, and not in bin/release/ or bin/debug/. This is the same level where I have a Config folder containing umbracoSettings.config.

    Next, I went to go and check the Test box, where the service is running on a full time basis. Inside the service folder, there is an App_Data folder with a umbraco.config file in it. The file was last modified on 30 January 2015, which is when I last restarted the service to do an update. The Windows service runs on the application server and the web site runs on a separate web server.

    My concern is that every time the definitions (content) are changed and published, the umbraco.config file in the Windows service folder will not be updated unless the Windows service is restarted. 

    I have two questions:

    1. The service operates on a batch mode, where a set of files are uploaded with a trigger file. The trigger file starts the run and, once the full set of files are processed, the service goes back to waiting for the trigger file. What is the implication of deleting the App_Data folder at the end of every run? There are currently 51 definitions in the content that are retrieved for every run. This number is unlikely to change by very much during the lifetime of the site.  

    2. Or Would it be preferable and safe (i.e. no danger of corrupting the cache) to point the Windows service to the umbraco.config file in the website by adding an umbracoContentXML setting to the application settings? Both the Windows service and website point to the same database.

    Thank you in advance, Adam.

Please Sign in or register to post replies

Write your reply to:

Draft