How to Run Locally

This article demonstrates how to run MID locally

Instructions

 

  1. Clone or download the project (Solution in Visual Studio 2022)

    1. Check here for the repo location: MIC_CAM

  2. Need necessary permissions on Azure Active Directory.

  3. Setup User Secret to each project in MIC_CAM:

    1. Go to this link ncdmidkv01 - Microsoft Azure

    2. image-20240208-165228.png
      Open the secret, and view the latest value:
image-20240208-165320.png

c. Click to view the secret, then copy by using the 'clipboard' icon:

d. Then navigate to VisualStudio, and open the appropriate project, in the examples above, we're using MID API. Right click and select 'User Secrets'

e. That should open up a blank json file in a new tab, like this:

f. Paste the contents of the clipboard into this file, ensure that proper JSON formatting is kept, and no corrupt characters (possible encoding issues) are present.  Save and you're done!

g. Repeatedly do it for every project in Azure.

h. This will need to be done for: DigitalSignature API, MID API, MID Website, MIUA Website, MIUS API and MIUS WinForm Legacy. Note: For MIUA Website (External) once the secrets copied, make sure to update your email address in the secrets and also uncomment lines For Dev properties and comment out the Prod once.

i. MIUS WinForm Legacy is VB and does things a little different. Instead of a user secret file, we have a secureconfig\secrets.config:

h. Similar steps to above, except do NOT include that file within source control.  We've set up GIT IGNORE so that file is excluded from source control

NOTE: we are currently in the processing of uploading the secrets right now, so they're not all available

  1. Add your user account into GC Notify

  2. Add your user account into DocuSign

  3. Once in visual studio, right click on MIC_CAM solution and click "Configure StartUp Project…"

 

  1. Rebuild the solution to check if there is any package missing

  2. Click Start and two application pages will open

  3. Need to check the latest keyvault in user secrets. need to check if the active config is for DEV not PROD

  1. Need a user id in MTOA.

By default once user call api https://wwwappstestext.tc.gc.ca/Saf-Sec-Sur/13/MTAPI/api/v1/users/emails?email=user.name%40tc.gc.ca will return empty if he doesn’t register.

That will causes problem once user tries to change the status of a service request.

Error logs like below:

Sending HTTP request POST https://wwwappstestext.tc.gc.ca/Saf-Sec-Sur/13/MTAPI-INT/api/v1/servicerequests/96473/updatestatus?userId=-9999&serviceRequestStatus=OnHold
2024-02-29T15:49:04.221348929Z [40m[32minfo[39m[22m[49m: System.Net.Http.HttpClient.mtoaApiService.ClientHandler[101]
2024-02-29T15:49:04.221392730Z       Received HTTP response headers after 179.0063ms - 403
2024-02-29T15:49:04.221398130Z [40m[32minfo[39m[22m[49m: System.Net.Http.HttpClient.mtoaApiService.LogicalHandler[101]
2024-02-29T15:49:04.221402430Z       End processing HTTP request after 254.3198ms - 403
2024-02-29T15:49:04.221922135Z [41m[30mfail[39m[22m[49m: MTOAAPIService.Api.Controllers.ServiceRequestApiController[0]
2024-02-29T15:49:04.221945136Z       HttpStatusCode.Forbidden
2024-02-29T15:49:04.238087304Z [15:49:04 ERR] HttpStatusCode.Forbidden
2024-02-29T15:49:04.238112404Z 2024-02-29T15:49:04.2215524+00:00 | [EROR] |  | 2716246415af | 28 |  |  |  |  | HttpStatusCode.Forbidden
2024-02-29T15:49:04.238401907Z [41m[30mfail[39m[22m[49m: MTOAAPIService.Api.Controllers.ServiceRequestApiController[0]
2024-02-29T15:49:04.238418708Z       HttpStatusCode.Forbidden
2024-02-29T15:49:04.254590076Z [15:49:04 ERR] HttpStatusCode.Forbidden

The userid will equal to -9999 if you don’t have registered.

To fix it, you need to request for the registration by intake form Microsoft Forms