Set up local IIS environment - acrotron-spezvuz/auralization-proto GitHub Wiki

Let's prepare an environment

Enable IIS Manager (if it is not enabled):

  • Open Windows Features window
  • Expand Internet Information Service
  • Expand Web Management Tools
  • Select IIS Management Console
  • Push _Ok _and Wait until everything is installed

Enable IIS Manager

Important !

Install Current .NET Core Hosting Bundle installer (direct download) and restart Windows.

Prepare ASP.Net Core Environment

Every time after publishing to local IIS (into some folder), configuration should be changed for proper work according to local IIS sites settings, paths, domains etc.
To avoid manual configuration editing (when some important values can be changed and pushed to the repo) let's prepare our own local configuration.

  1. Set an environment variable globally:
  • Open the Control Panel > System > Advanced system settings and add or edit the ASPNETCORE_ENVIRONMENT value: Staging ASPNETCORE_ENVIRONMENT value
    More about Using multiple environments in ASP.NET Core. Useful for CI/CD with ASP.Net core.
  • Reboot Windows
  1. Add additional appsetting.Staging.json to both SPA and API projects:
  • Right click on the project > Add new > App Setting File
  • Enter name: appsettings.Staging.json an push Add
  • Add this file to .gitignore
  • Copy everything from appsettings.Development.json to appsettings.Staging.json Staging config

Deploy to the local IIS

  • Right click on any ASP project in the solution and select Publish
  • Select Folder and choose a folder for publishing, for example: C:\Web\spa Choose folder
  • Push Publish
  • Go to IIS Manager
  • Add Website and fill fields, for example: Add Website
  • Push Ok
  • Now you can browse running instance in the browser by url, for example: http://localhost:8080/
  • Repeat steps for next ASP project

So far, for now both projects published and have an urls, for exmaple:

Open appsetting.Staging.json in SPA project and edit it:
"AuralizaitionEndpoint": "http://localhost:8090/api/Auralizarion" SPA: Staging config Save it and Publish SPA again.

Open appsetting.Staging.json in API project and edit it:
"AllowedOrigins": [ "http://localhost:8080", "http://127.0.0.1:8080" ]
API: staging config
Save it and Publish API again.

Done.

PS: both projects can be merged into one, the resulted project will be easier to config and deploy.