Configure Azure Cache (<dataCacheClients>...) of WebRole in cscfg file? - azure-appfabric

Currently, I have my Azure Cache configuration
<dataCacheClients>
<dataCacheClient name="default">
...
inside my Web.config of my Azure WebRole. I would like to be able to easily modify the Azure Cache settings after the cspkg package has been created, i.e. I would like to move the configuration into the cscfg file.
I don't think that's possible without hand-coding all the possible configuration options of Azure Caches (and then interpreting those options and setting the configuration programmatically in the DataCacheFactory). Am I overlooking something?

in webrole (RoleEntryPoint derived class) onstart, you could overwrite web.config caching part with the relevant settings from your .cscfg file
also add eventhandler to the environment changing (RoleEnvironment.Changing += RoleEnvironmentChanging;) with e.Cancel = true so that the webrole restarts when ever you change .cscfg # the management portal

One walkarround is to rename your .cspkg file to .zip file. Then unzip the file and take a look to the files. You will find .cssx files (the larger files) representing each webrole / working role. rename to .zip and expand. Then you will find a "approot" folder. Your dlls, webconfig, etc are there. You can mess with the webconfig and zip+rename the way back.
It's not elegant at all, but sometimes is the best way to figure out what exactly are you publishing.

Related

IIS Http Module config file write auto creates .bak file

I've got a custom http module in IIS 8 that uses a set of config files to control how it works. These are all named *.config and are mainly in a filesystem folder outside the scope of the site, with one in the bin folder.
In the module I use system.io.file.writealltext to update the files. When I do this, the file I'm writing to is copied to a .bak file before the new file is written to. This only seems to happen when the file extension is .config (I've tested with other extensions and it doesn't happen).
It also doesn't happen everywhere - it happens with all the deployments I have on an Azure Windows Server 2016 VM, but doesn't happen much on other deployments (we have clients with a variety of versions of Win Server & IIS).
I suspect its an IIS setting, to automatically create a .bak when a .config file is changed, but can't find any info on this.
Does anyone have any idea why this is happening and how I can turn it off?

WSO2 ESB HTTP Endpoint does not get added to the Synapse configuration

I have built an ESB Project with an HTTP endpoint. But for some reasons. The Endpoint that I have defined and added to the ESB Solution does not seem to be reflected in the project and seem to be not reflecting when I deploy to the server. The endpoint is basically not being used. I have also tried to check the under the Defined Endpoints tab in the server Enterprise Integrator console, #
Home > Manage > Service Bus > Endpoints
but it isn't there. Numerous restarts have not helped neither has undeploying and redeploying the car file. Can someone point out where I might have gone wrong? As usual, thanks in advance.
Could be different things, to check:
Extract the .car file (it's just a .zip, so rename or use 7zip to
extract) and see if your endpoint is there.
Check if the serverrole in the pom file is correct (should be EnterpriseIntegrator it think)
Sometimes renaming artifacts causes problems as the file does not get renamed correctly or a reference is not updated in one of the
project files. Try removing the endpoint and use 'search in files' to
remove any lingering references in pom files.

manage and configure windows services with an own control panel

I have written some windows services. Each service has some settings that I currently store in a .ini file.
I would like to manage the services now in a control panel and would like to be able to manage the settings there in a collective manner.
Are the respective app.config files the right choice?
or should i store the settings (like timer Intervall, etc.) in the registry?
If not
How to Access the app.config files?
I have tried something like that
Dim fileMap As ConfigurationFileMap =
New ConfigurationFileMap("myService.exe.config")
Dim configuration =
ConfigurationManager.OpenMappedMachineConfiguration(fileMap)
But the AppSettings are Nothing
or am I on the wrong track?
I hope somebody has a great idea
how to manage and configure windows services with an own control panel?
First of all: With the ServiceController Class you can control every Serivce (Start, Stop, Restart, and so on). You should check out the example at the MSDN page if you want to know how it works.
How you save your settings is your own choice. You could use the .config file, a .ini file or just the registry. Just choose the option which works better for you.
Since your services already use a .ini as a config file you could just access and edit these files with your control panel. I guess the .ini files are saved in the same folder where the service.exe is located. So you can use AppDomain.CurrentDomain.BaseDirectory to find out where the service is located on the machine and start editing it. For your control panel you can also use a .ini config file our just play around with My.Settings
Hope this brings you on the right track!

Advanced setting not surviving application build - Sitefinity

I'm changing a value in the advanced settings of the CMS, specifically the ProviderTypeName of Blogs -> Providers -> OpenAccessDataProvider
However, when rebuilding the site the setting is reverted to its default.
I believe this is happening because the property is stored in a file, and my build and deployment is overwriting it with whatever is in my repository.
Where is this setting stored in the file structure; or if I'm way off base in my assumption, how do I get this setting to stick?
You right, most probably you overrode configuration changes during the deployment. Most of the time, I am excluding all configuration during website deployments and from VS project.
By default, Sitefinity 10 is using a hybrid mode that stores configuration files on both the file system App_Data/Sitefinity/Configurations and the database in table [sf_xml_config_items]. Documentation: https://docs.sitefinity.com/auto-storage-mode-of-configurations
Also, there is a way to move configurations to database only: https://docs.sitefinity.com/database-storage-of-configurations

Moving configuration outside of IIS root

In regular ASP.NET/MVC development we could move configuration entries from web.config in the application/site directory to machine.config.
With ASP.NET Core is there something similar, now that we have json based configuration files?
Well, technically, you can pull in any JSON from any location. Just pass the full filesystem path, instead of just "appsettings.json".
However, really, if you're talking about externalizing your configuration, you should probably use environment variables or some service like Azure Key Vault.