Azure deploy slot swap && URLs in config files - asp.net

I'm sure - it's very common Q, but I'm new with Azure and don't sure how correctly even google this question.
So - here we have some App service with URL site.com. It have "swap" slot, with URL site-staging.com.
Our deployments scheme is:
CI server > deploy to STAGING > check > if ok then swap to PROD
Questions is: in file Web.staging.config - we have:
key="ida:PostLogoutRedirectUri" value="http://site-staging.azurewebsites.net/admin"
But. After "swap" will be done - URL will be changed to "http://site.azurewebsites.net/admin", while in Web.staging.config - it still will use old value - "http://site-staging.azurewebsites.net/admin".
So - after user will open "http://site.azurewebsites.net/admin" and log in - he will be redirected to "http://site-staging.azurewebsites.net/admin" (taken from Web.staging.config), what is obviously wrong direction.
On similar setup in AWS for example - I'd try to use some variables in my "shell-swap-scripts", to determine that staffs and change config values.
But what about Azure's swapping?
Any tips appreciated.

For all settings that change between slots, the best practice is to configure app settings and connection strings from the Azure portal and not using different web.config files. All settings defined in the portal override the values that may be present in the web.config file (for app settings and connection strings).
You can also define specific-slot settings.
See: https://azure.microsoft.com/en-us/documentation/articles/web-sites-staged-publishing/#configuration-for-deployment-slots
Hope this helps,
Julien

A simple way to configure Application settings that either switch (or do not switch) depending on the slot setting. Information about configuration can be found in the Azure docs:
https://azure.microsoft.com/en-us/documentation/articles/web-sites-staged-publishing/#configuration-for-deployment-slots

Related

Can SSO config only import selective SettingsFileGenerator.xml settings?

The SettingsFileGenerator.xml file seems to have two purposes. One is to set the SSO Config and the other is to dynamically replace settings in the PortBindingsMaster.xml for each environment. I am replacing dozens of values in the PortBindingMaster.xml file that don't need to also be stored in the SSO config. Is there a standard way to specify which settings I want to be stored in the SSO config so I don't store a lot of extra values there?
Unfortunately, what you're asking is not directly supported. There a couple of workarounds though.
You can maintain a separate settings file for runtime only settings and use a custom CustomPostDeployTarget task to Exec SSOSettingsFileImport.exe with you runtime settings file.
Or, you can use a set of UpdateSSOConfigItem elements as referenced here: Deploy Configuration Settings into SSO.

Demandware - Pipeline not found for current domain

I already made pipeline. Which is working fine. Suddenly it give error like
2015-12-18 02:39:08.091 GMT] ERROR system.core ISH-CORE-2368 Sites-SiteGenesis-Site core Storefront [uuid] [request-id]-0-00 [timestamp] "Error executing pipeline: Hello com.demandware.beehive.core.capi.pipeline.PipelineExecutionException:Pipeline not found (Hello) for current domain (Sites-SiteGenesis-Site)"
Does anybody know how to solve this?
In the event that your pipeline can not be found for the selected domain, please go trough and verify all of the following:
Double check Pipeline-Node naming
Pipeline URLs are generated by their name and your desired entry node, in this scenario, I would expect a file named Hello.xml in you cartridge's pipeline directory, and a start node named Start, would be accessed via {instanceURL}/on/demandware.store/Sites-mySite-Site/Hello-Start
Try and force upload of your cartridges
Occasionally the files on the server will not be updated correctly when a save is made; to force an update, right click your project, click Demandware > Upload Cartridges
Check your Cartridge Path
If you are using a shared instance, or your instance is re-provisioned, you may need to check your cartridge path to be sure your custom cartridge(s) are still there.
Check your Code Versions
Occasionally you may increment / change your code version - if you do, make sure that the path you select in Studio is the one that you have selected in Business Manager.
Tech Support
Should you still have issues following the four steps above, please file a support ticket and the tech-support team will be able to provide you with more assistance.

Confused on what is the correct procedure on storing passwords in Web.config for Azure deployment

I've had a very frustrating experience on putting an MVC 5 app on Azure. I have been reading the following page: http://www.asp.net/identity/overview/features-api/best-practices-for-deploying-passwords-and-other-sensitive-data-to-aspnet-and-azure
But what I haven't managed to put in my head is the following:
Security Warning: Do not add your secrets .config file to your project or check it into source control. By default, Visual Studio sets the Build Action to Content, which means the file is deployed. For more information see Why don't all of the files in my project folder get deployed? Although you can use any extension for the secrets .config file, it's best to keep it .config, as config files are not served by IIS. Notice also that the AppSettingsSecrets.config file is two directory levels up from the web.config file, so it's completely out of the solution directory. By moving the file out of the solution directory, "git add *" won't add it to your repository.
And:
Security Warning: Unlike the AppSettingsSecrets.config file, the external connection strings file must be in the same directory as the root web.config file, so you'll have to take precautions to ensure you don't check it into your source repository.
The problem is the following: When I upload the Web.config file with the external files without being included I get hit by "The System cannot find the file specified", so for it to go away I must include the .config files defeating the purpose of Microsoft's post.
I really really really do not understand. I have added the connectionStrings and appSetting's keys in Azure's portal. What is the correct and secured way of putting my passwords and secrets online? What am I missing? Is it because I'm running in Debug mode?
According to this:
How can I secure passwords stored inside web.config?
There is nothing to worry about accessing the Web.config file...
But that just defies Microsoft's post.
Thanks.
I find the following technique to be the easiest way to do this.
Instead of putting the deployment values of these settings into the web.config, I keep the test values in there instead. I then put the deployment values into the Application Settings section of the Azure Website via the Azure Portal:
When the website runs, these settings will take precedence over what is in the web.config. This helps me avoid externalized files, allows me to keep sane development configuration that the team can share, and makes deployment very easy.
The best way is to set your secrets in the Connection Strings section of the portal. Any values set there will override values you specify in your web.config file.
This way they are only exposed to people who have admin access over the site itself. Having full access to the source won't even be enough to get the secret values.
More details here

Invalid config file in clean install - missing configuration section 'contactRepository'

I have done the following:
installed a clean Sitecore 7.5 instance
added the relevant asp.net web forms controls and pages to support the site
imported and published a content tree from an old application
Visiting the base site url yields a YSOD with the error message:
Could not find configuration node: contactRepository
Now I understand what this means - there's an expected configuration section that is missing. Adding an empty element contactRepository yields an expected message that this section is not defined.
What is contactRepository, what is its associated configuration section type, what is it for and what values should be specified in it? Alternatively, how can I turn off whatever demands this section to be present?
edit #1:
In the Sitecore.Analytics.config file in the node there are the following two lines:
<!--This configuration node is obsolete and will be removed in a future version of Sitecore. Use "contactRepository" node to get access to Contact repository-->
<contactRepository ref="contactRepository"/>
The comment is total gibberish. Which node? 'Use' how? 'get access' in what sense? How is this different to what's there?
replacing with an empty <contactRepository> without the ref attribute, commenting out this node, both nodes, and the whole tracking node makes no difference to the application's behaviour.
Looking at my local Sitecore 7.5 setup the Contact Repository settings should be in your Sitecore.Analytics.config.
The contacts repository settings relate to the new xDB stuff.
Please ensure you have the correct Sitecore.Analytics config files for 7.5.
There should be around 15 config files with new settings for xDB.
Please read this blog post for more information on the new Analytics setup.
https://www.sitecore.net/learn/blogs/technical-blogs/getting-to-know-sitecore/posts/2014/10/introducing-the-sitecore-analytics-index

Local Coldfusion server for multiple domains / URLs

I want to get CF9 with IIS 7 setup locally to run with multiple domains.
I have read this one but it doesn't say anything about the actual setup.
Need help with multiple URL setup on local CF9/Jrun install
I setup IIS so that I can start 127.0.0.1/domain1/index.cfm The page loads properly
but all subsequent links fail with
Could not find the included template: /_/definesession.cfm
But I see the file when typing in file:///C:/InetPub/wwwroot/domain1/_/DefineSession.cfm
The files are there but apparently the server is only reading the directory correctly
If I test http://127.0.0.1/domain1/_/BrowserDetect.cfm with no includes just a self contained file it executes properly.
The path in IIS is set to C:\InetPub\wwwroot\domain1
The bindings hostname is just domain1 no TLD
Also the second instance 127.0.0.1/domain2/index.cfm is working correctly. And here as well including subdirectories is failing.
ADDITIONAL NOTES: (added 1/3/12)
I guess it has to do with the CF mapping. I now moved the code to c:\coldfusion9\wwwroot\domain1_... and it sort of works.
In other words I start the program here: C:\inetpub\wwwroot\domain1\index.cfm Inside that index is for instance
But it executes the file located here: c:\coldfusion9\wwwroot\domain1_\definesession.cfm Just couldn't find anything in the web about mapping a local CF9 to that situation. Any idea??? –
You might have a ColdFusion mapping for "/" that needs to be adjusted.
OK I fixed it. There were multiple issues:
For whatever reason there were some issues with IIS and I had to reinstall it.
I had to make sure 9.0.1 was installed
I had to run Webserver Configuration Tool multiple times to actually get the Handler Mappings in order.
http://127.0.0.1/domain1/ was wrong - it must be http://domain1/ etc.
I forgot to add the domains to the host file on the machine - stupid me
I had to redesign my mapping to avoid overlaps between domains (i.e. mapping CFCs to /_/cfc/ on all domains needed to have different mapping names.
Now I have several different domains on my local machine and they work just fine.

Resources