A direction we are taking Process PA is white labelling for our partners. To do this we are still hosting on the same scalable platform on Microsoft Azure and essentially adding another level of multi-tenanting in our codebase. When a user navigates to https://app.processpa.com/ they will get our first party branded experience. However, when a user navigates to something like https://partner1.processpa.com, they will get a tailored experience complete with branding, different resources, templates and features specific for those customers supported by our partners.
Building out the experience using Dependency Injection with Branch By Abstraction based on the host is reasonably straight forward. I however wanted the local development environment to be run in the same way, rather than switching in code for whatever partner experience was being built out at the time. To do this I need to be able to configure local DNS records for localhost and IISExpress. The answer I found on StackOverflow but below are the simplest steps that worked for me.
- Open Notepad as an Administrator
- Open in Notepad
- Copy the comment lines for localhost host and add as your DNS records
- For Visual Studio 2015, open
- Find the site and add the bindings you need, making sure to change the ports.
<binding protocol="http" bindingInformation="*:1704:localhost" />
<binding protocol="https" bindingInformation="*:44300:localhost" />
<binding protocol="http" bindingInformation="*:1705:partner1.localhost" />
<binding protocol="https" bindingInformation="*:44308:partner1.localhost" />
- To prevent the need to run Visual Studio as admin to start IISExpress on those ports, open an Administrator command prompt and run:
netsh http add urlacl url=http://partner1.localhost:1705/ user=machine\username
netsh http add urlacl url=https://partner1.localhost:44308/ user=machine\username
If you have certificate trust issues check out: https://blogs.msdn.microsoft.com/robert_mcmurray/2013/11/15/how-to-trust-the-iis-express-self-signed-certificate/.