TABLE OF CONTENTS
- Define API Config Transforms
- Publish the Znode API
- Create the API IIS Site
- Confirm the API IIS Site Runs
- Define Admin UI Config Transforms
- Publish the Znode Admin UI
- Create the Znode Admin UI IIS Site
- Confirm the Admin UI IIS Site Runs
- Define WebStore UI Config Transforms
- Publish the WebStore UI
- Create the WebStore UI IIS Site
- Confirm the WebStore UI IIS Site Runs
- Configure External (non-localhost) URL's
Visual Studio has a built-in Publish feature to help build, and optionally, deploy the application to sites on an IIS server. This document is not meant to teach how the Publish functionality itself works, but rather, show an example of how Znode can be published to folders, ZIP-ed, copied to a server, and un-ZIP-ed to IIS sites at a high level.
A more ideal long term solution would be to publish directly to a remote IIS server, or, set up a full CI/CD pipeline, but that is outside the scope of this document.
As mentioned, general .NET training is not within the scope of the Znode Docs. To learn more about Visual Studio's Publish feature in general, their Publish Tutorial may be a good place to start.
Define API Config Transforms
This example uses the default Web.Release.config files as config transform override for the published packages. These config transforms need to change any settings from what the developer is using on localhost (ie: what is defined in Web.config), to properly configure the applications as desired on the server-hosted sites.
This example first walks through publishing the sites to simply run on localhost on the server. This means the only configuration values that need to be overridden are the DB connection strings. For example:
<add name="ZnodeECommerceDB" connectionString="Data Source=vm-sql-01;Initial Catalog=znode_931;User Id=sa;Password=myP@ssword;Column Encryption Setting=Enabled" providerName="System.Data.SqlClient" xdt:Transform="SetAttributes" xdt:Locator="Match(name)" />
<add name="Znode_Entities" connectionString="metadata=res://*/DataModel.ZnodeEntities.csdl|res://*/DataModel.ZnodeEntities.ssdl|res://*/DataModel.ZnodeEntities.msl;provider=System.Data.SqlClient;provider connection string="Data Source=vm-sql-01;Initial Catalog=znode_931;User Id=sa;Password=myP@ssword;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" xdt:Transform="SetAttributes" xdt:Locator="Match(name)" />
The Data Source, Initial Catalog, User Id, and Password all need to be properly filled in depending on the details of the DB to connect to.
These DB connection strings need to be added, and other overrides should be removed, resulting in something like the following:
Publish the Znode API
To publish a Znode install to IIS, it's best to start with the API. This is because the API can function on its own, and the other parts of Znode consume the API.
Create a publish profile for the Znode.Engine.Api project.
Build a published package.
ZIP the published package.
Copy the ZIP to the server.
Un-ZIP the ZIP on the server.
Create the API IIS Site
Once the publishing package is on the server, a new IIS site must be created to host the package as a site. Note that creating an IIS site is only needed on initial deploy.
Confirm the API IIS Site Runs
Now that the API site is created, open localhost:44762 in a browser to confirm it loads.
Define Admin UI Config Transforms
With the API running, the next step is to repeat the same process to configure (and build and deploy) the Admin UI.
The Admin UI's Web.Release.config should be configured with any overrides applicable to the server environment. In this example, no overrides should be applied.
Publish the Znode Admin UI
Repeat the same publishing process, but for the Znode.Engine.Admin project.
Create the Znode Admin UI IIS Site
Repeat the same process of creating a site, but for the Admin UI.
Confirm the Admin UI IIS Site Runs
Define WebStore UI Config Transforms
With the API and Admin UI running, the next step is to repeat the same process to configure (and build and deploy) the WebStore UI.
The WebStore UI's Web.Release.config should be configured with any overrides applicable to the server environment. In this example, no overrides should be applied.
Publish the WebStore UI
Repeat the same publishing process, but for the Znode.Engine.WebStore project.
Create the WebStore UI IIS Site
Repeat the same process of creating a site, but for the WebStore UI.
Confirm the WebStore UI IIS Site Runs
Configure External (non-localhost) URLs
To expose the Znode install on external/public URLs:
Create the CNAME/A records with the domain registrar (eg: AWS, GoDaddy, etc.).
Add the appropriate IIS binding for each of the sites. This example leaves the localhost bindings in place so that the apps can communicate internally over localhost. Examples of public URL's:
Configure Znode's DB with the new URLs.
The ZnodeDomain table needs to have entries for each URL that the API, Admin, and WebStore are to be hosted on. These entries can be directly edited (eg: with SSMS), or, through the Admin UI itself:
Once this is completed, the WebStore will be reachable over the public URL: