Hello Angular World (from Visual Studio and Local IIS)
Hosting with Local IIS
My preference it to develop web applications using my Local IIS server opposed to the IIS Express server that ships with Visual Studio. I have several reasons for this, two of which are:
- You have more control over how your application is served, for instance domain names and port numbers
- You can test your web applications even if Visual Studio is not running
Hosting node.js applications in IIS on Windows
- Prerequisites
- URL Rewrite (from Microsoft)
https://www.iis.net/downloads/microsoft/url-rewrite - js (should already be installed)
https://nodejs.org/en/download/
- URL Rewrite (from Microsoft)
- Install “iisnode”
- Download iisnode from tjanczuk/iisnode GitHub
- https://github.com/tjanczuk/iisnode
- Once installed, navigate to: C:\Program Files\iisnode (for x64 version)
- Open a Command Prompt window using Run as Administrator
- Optional: To set up the sample node app:
- Right-click setupsamples.bat and click Run as Administrator
- Follow the instructions if required…
- Once installed open a browser and navigate to: http://localhost/node
- Restart IIS
- Open a Command Prompt window using Run as Administrator
- Type iisreset /noforce and press Enter
C:\Windows\system32>iisreset /noforce Attempting stop... Internet services successfully stopped Attempting start... Internet services successfully restarted C:\Windows\system32>
Add an IIS Application (Website)
You will need to have already turned on Internet Information Services as a Windows Feature.
- Open Internet Information Services (IIS)
- Expend your local server node
- Right-click on the Sites folder
- Click Add Website…
- Enter the following:
- Site name: Angular.World
- Physical path: (navigate to the Hello.Angular.World project folder)
- Port: 12345
- Click OK
Config Visual Studio Web Application
- Select Angular.World and right-click
- Click Properties or Alt+Enter
- Click on Web
- Change the Servers type to Local IIS
- Change the Project Url, for example: http://localhost:12345
- Press Ctrl+S
Restore “package.json”
- Open/expand the Angular.World
- Right-click json
- Click Restore Packages
Note: You can use Visual Studio’s Output window to monitor the progress of the packages being restored.
Test Your Local IIS Application
- Open your favourite browser (e.g. Chrome)
- Enter the full path to the _index.hml page, for example: http://localhost:12345/_index.html
Note: If the Application fails, then open the Developer tools (for Chrome press F12) and review the output in the Console window
You must be logged in to post a comment.