Developer forum

Forum » Development » Getting to a "Clean" version of GlobalSettings.Config

Getting to a "Clean" version of GlobalSettings.Config

Justin Sjouw Dynamicweb Employee
Justin Sjouw
Reply

I'm working to produce a "clean" version of GlobalSettings.Config, so that I can use it as a generic baseline for new solutions.

On top of that I will then add GlobalSettings.Database, .CommonInformation, .MailServer etc

The version on GitHub in Swift contains a lot of setting for ProductCategories, I no longer have these categories in my Solution. Should they have been deleted from the config and/or can I safely delete them? (I'll try ofcourse but curious of when they are created/deleted by default)


Replies

 
Justin Sjouw Dynamicweb Employee
Justin Sjouw
Reply

Additional Question. Is see sometimes a section is repeated, containing a single variable. for example:

I already have a GlobalSettings.Database.Config on this solution, Is there a reason this is put in a seperate section, or is it just a "glitch" and should/could it be moved to GlobalSettings.Database.Config?

 

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

Sure, you can just delete what you don't need in GlobalSettings.config
The field settings you see there are the ones you can configure at Settings > Ecommerce > Advanced settings > Fields
When you save the settings on that screen they will be persisted in the config file. In DW10 we have moved those settings to the database instead.

We only look for the full key for a given setting in all existing .config files, e.g. /GlobalSettings/System/Database/CommandTimeout
The name of the .config file determines priority (alphabetical sorting). Naming the file GlobalSettings.Database.config has no special meaning. You can name it GlobalSettings.Storage.config or anything else.
If you want a given setting in GlobalSettings.Database.config then you need to add it there and then you can remove it from other .config files.

I hope that makes sense.

/Morten

 
Justin Sjouw Dynamicweb Employee
Justin Sjouw
Reply

Hey Morten,

Yes that makes sense, thanks. 

Since I don't know all settings by heart :-) and I would like to make sure I don't overwrite anything on deployment that has been set by somebody in the production admin interface, does this alphabetical order also apply for when you add a missing/new key to a config file. In other words I could put a GlobalSettings.AutoAdded.config on there, and everyting new will be added there,(then I can check that file before deployment and see if I want to control any of the new setting via the deploy) or will it then still go into GlobalSettings.Config because that is higher in the hierarchie?

Thanks,

Justin

 

 
Justin Sjouw Dynamicweb Employee
Justin Sjouw
Reply

Still a bit unclear on when settings get picked up, and what relates to what.

I deployed a new version of GlobalSettings.config, and reset the apppool, in the settings I have:

<UseUrlProviderForSitemap>True</UseUrlProviderForSitemap>

That is under /System/Url

But when I login to the backend I still see:

Is there some cache I should explicitlty reset after deployment?

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

Settings are cached in memory, so if you recycle the app pool then it shouldn't be a problem.
It seems that something might be happening between the deployment of the config file and the app pool recycle.
If something tries to save a setting then all currently cached settings will be persisted to config files. 

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

Actually, only the changed settings will be persisted (merged with config from disk), so I'm not sure what could cause the scenario you are experiencing.

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

Are you sure that you recycled the correct app pool?
If you have deployed a config file with a value for /Globalsettings/System/Url/UseUrlProviderForSitemap then it should be picked up by the system after app pool recycle.
Make sure that you don't have any other config files with the same setting.

<?xml version="1.0" ?>
<Globalsettings>
  <System>
      <Url>
          <UseUrlProviderForSitemap>True</UseUrlProviderForSitemap>
      </Url>
  </System>
</Globalsettings>
 
Justin Sjouw Dynamicweb Employee
Justin Sjouw
Reply

Hey Morten,

I'm using an ftp upload, so it is a bit unpredictable when exactly the apppool is reset. Ican only control it by touching the web.config or with the app_offiline.htm file I think.

even with the app_offiline.htm I'm having to retry to overwrite some files because the system indicates they are still in use by another process, doesn't feel very stable.

Cheers,

Justin

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

I assume that you are working on a DW9 solution.

How do you deploy? Are you using devops, webdeploy, powershell or just ftp?

Which files are in use by another process? Assemblies in the /bin folder or other files?
Make sure that you don't have multiple applications using the same folders - or make sure that you take them all offline.

You can try this approach if files are still in use by another process:

  1. Add app_offline.htm file to the application root folder.
  2. Add a delay here, if possible. The duration should exceed the "Shutdown Time Limit" on the app pool (default is 90 seconds).
  3. Deploy the changes - you should not experience any locked files here.
  4. Remove app_offline.htm file.

If that doesn't work then I have no idea what to do.
I think you have to take a look at server logs or do some debugging to find out what is going on.

/Morten

 

You must be logged in to post in the forum