Adventures on the edge

Learning new development technologies (2015 - 2018)
    "When living on the bleeding edge - you sometimes have to bleed" -BillKrat


It is recommended that you familiarize yourself with Working with Multiple Environments, it is a comprehensive article that goes into detail on how to configure your application for Development, Staging, and Production.  

One of the first things I encountered was that the launchSettings.json file was not available under Properties (reference bottom pane of figure 1).   A second issue I encountered was that the StartupDevelopment and StartupStaging class methods were not not being invoked as expected – the application defaulted to the Startup class methods.

Figure 1

To resolve the first issue I switched over to the “web” profile (discussed in the article) and set the ASPNET_ENV value to Staging.   There was an asterisk indicating that the project’s Debug setting was changed.  Once I clicked the save button (see #3 top of figure 2) the launchSettings.json file was created (ref figure 3).

Figure 2

Figure 3

The second issue required me to step through the source code.  Where the Startup conventions worked for methods, e.g., ConfigureDevelopment() was invoked, I could not get my StartupDevelopment class to be recognized by application – it kept defaulting to the Startup class.

In reviewing the source code, line 61 of figure 4 is looking for the startup assembly name (in this case GwnBible) and then StartupDevelopment as set on line 55.  I had created my StartupDevelopment and StartupStaging classes under an Environment folder which was part of the namespace (line 6 of middle pane) – this prevented the classes from being discovered by the StartupLoader.  Once I changed the namespace to GwnBible everything started working as expected.

Figure 4

Comments are closed