Exposing And Configuring A Server
Learn how to use a local web server to debug client web applications on the internet.
After completing the steps in Setting Up Your Local Environment you are ready to debug client code as a local web server exposed to the internet.
Using the IDataService to access the Corporate Admin Database?
The Corporate Admin Database is secured behind a firewall. In order for your local web server to have access to the database, your public IP address will need to be added to the allow list by following the process steps contained within SQL Server Firewall Rules.
-
Run a Local Debug Web Server.
Run your web application as a web server. Learn how to run an ASP.NET Core web application as a web server in Visual Studio by following the steps outlined in the Microsoft tutorial: How To Run a C# Program in Visual Studio
Take note of the port that it is using, specifically the HTTPS port, which is 7264 in Figure 1 below. You will need it in the next step.
-
Forward Traffic To The Server From A URL.
Run the Ngrok executable and start an HTTP tunnel by running the command ngrok http and passing the port from step 1.
ngrok http https://localhost:7264 --host-header="localhost:7264"
Take note of the HTTPS URL, which is
https://87dc-73-228-64-197.ngrok.io
in Figure 2 below. You will need it in the next step.
-
Update Configurations in Corporate Admin.
Update the configurations you want to debug locally to point at the public URL created in step 2.
*ex: Given this URL
https://87dc-73-228-64-197.ngrok.io
from step 2 a Webhook configured to call thehttps://acme.clientextension.directscalestage.com/webhook/CreateOrder
endpoint would be updated tohttps://87dc-73-228-64-197.ngrok.io/webhook/CreateOrder
See how to update Corporate Admin configurations with the following links.
Configuring Process Hooks
Configuring Merchants
Configuring External Pages
Configuring Webhooks
It's best practice to keep your stage Environment stable. Do yourself a favor and set some type of reminder to change these configurations back to your Stage server when you are done debugging.
Updated about 2 years ago