Publishing with Visual Studio (Optional)

TABLE OF CONTENTS

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.

img

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=&quot;Data Source=vm-sql-01;Initial Catalog=znode_931;User Id=sa;Password=myP@ssword;MultipleActiveResultSets=True;App=EntityFramework&quot;" 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:

img

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.

  1. Create a publish profile for the Znode.Engine.Api project.

  2. Build a published package.

  3. ZIP the published package.

  4. Copy the ZIP to the server.

  5. 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.

img

Confirm the API IIS Site Runs

Now that the API site is created, open localhost:44762 in a browser to confirm it loads.

img

img

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.

img

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.

img

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.

img

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.

img

Confirm the WebStore UI IIS Site Runs

img

Configure External (non-localhost) URLs

To expose the Znode install on external/public URLs:

  1. Create the CNAME/A records with the domain registrar (eg: AWS, GoDaddy, etc.).

  2. 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:

    1. admin.b2b931.amlamarket.com

    2. api.b2b931.amlamarket.com

    3. webstore.b2b931.amlamarket.com

  3. Configure Znode's DB with the new URLs.

    1. 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:

      1. https://support.znode.com/support/solutions/articles/43000591318-configuring-store-urls

      2. https://support.znode.com/support/solutions/articles/43000599609-managing-admin-console-and-api-urls

Once this is completed, the WebStore will be reachable over the public URL:

img



Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.