Skip to content

IIS Readme File Created #2160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 19, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 136 additions & 0 deletions docs/Examples/IIS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@

![Yeoman / Windows/ MEAN](http://joshlavely.com/images/yo_windows_mean.gif)
# Angular-Generator-Fullstack on Windows
This is a walk through to get generator-angular-fullstack up and running on a windows machine.
This walk through has been tested on:
- Windows Vista
- Windows 7
- Windows 8
- Windows Server 2008 (*all builds/ updates*)
- Windows Server 2012 (*all builds/ updates*)

## Prerequisites

**Install Python**
- Download 2.7 from
- Install to C:\Python27 (*The Default Path*) **
- After Python is installed add the %Path% (*C:\Python27\python.exe*) to your Windows Path Env variable.
- Start > Type ```Environment Variables``` > click "Edit the System Environment Variables" > Envrionment Variables >
Click "Path" > "Edit"
- Add C:\Python27\python.exe to the very end. (*Click into box and press 'End'*)

**Install NodeJS on Windows**
- Download the latest stable release of NodeJS from https://nodejs.org and install using all the default options.

**Install IISNode**
- Install Latest Stable release of [IISNode](https://github.com/tjanczuk/iisnode)

**Install IIS URL-Rewrite Module**
- Install the [URL-Rewrite Module](http://www.iis.net/downloads/microsoft/url-rewrite) extension

**Install MongoDB on Windows**
- Download the current stable release of MongoDB from https://www.mongodb.org/downloads and install using the "Complete" setup type and all the default options.
- Create the MongoDB data directory
- Create an empty folder at "C:\data\db".
- MongoDB requires a directory for storing all of it's data, the default directory is "C:\data\db", you can use a different directory if you prefer by specifying the "--dbpath" parameter when starting the MongoDB server (below).
- Start MongoDB Server on Windows
- Start the MongoDB server by running "mongod.exe" from the command line, "mongod.exe" is located in "C:\Program Files\MongoDB\Server\[MONGODB VERSION]\bin", for example for version 3.2 the following command will start MongoDB
``"C:\Program Files\MongoDB\Server\3.2\bin\mongod"``

## Getting your project started

**Install the generator**
- Create an empty folder for your project
- Open CMD as administrator and change directories to your app's directory ```cd c:\example```
- Run ```npm install -g yo gulp-cli generator-angular-fullstack```

## Move App into production
The below steps assume you have purchased a domain and have pointed your DNS to your public IP

**Build and prep**
- Run the build process ```gulp serve:dist```
- Move your *dist* folder to your desired directory (*This is where IIS will be pointed at*)
- Copy the contents of the 'server' folder **into** your 'client' folder
- Copy down the web.config from below and place this inside your 'client' folder (*save it as 'web.config'*)

```
<configuration>
<system.webServer>

<!-- indicates that the socketio.js file is a node.js application
to be handled by the iisnode module -->

<handlers>
<add name="iisnode" path="app.js" verb="*" modules="iisnode" />
<add name="iisnode-socketio" path="config/socketio.js" verb="*" modules="iisnode" />
</handlers>
<iisnode node_env="PRODUCTION"
nodeProcessCountPerApplication="1"
maxConcurrentRequestsPerProcess="1024"
maxNamedPipeConnectionRetry="100"
namedPipeConnectionRetryDelay="250"
maxNamedPipeConnectionPoolSize="512"
maxNamedPipePooledConnectionAge="30000"
asyncCompletionThreadCount="0"
initialRequestBufferSize="4096"
maxRequestBufferSize="65536"
uncFileChangesPollingInterval="5000"
gracefulShutdownTimeout="60000"
loggingEnabled="true"
logDirectory="iisnode"
debuggingEnabled="true"
debugHeaderEnabled="false"
debuggerPortRange="5058-6058"
debuggerPathSegment="debug"
maxLogFileSizeInKB="128"
maxTotalLogFileSizeInKB="1024"
maxLogFiles="20"
devErrorsEnabled="true"
flushResponse="false"
enableXFF="false"
promoteServerVars=""
configOverrides="iisnode.yml"
watchedFiles="web.config;*.js" />
<!-- indicate that all strafic the URL paths beginning with 'socket.io' should be
redirected to the server socketio.js, node.js, application to avoid IIS attempting to
serve that content using other handlers (e.g. static file handlers)
-->

<rewrite>
<rules>
<rule name="LogFile" patternSyntax="ECMAScript">
<match url="socket.io"/>
<action type="Rewrite" url="app.js"/>
</rule>
<rule name="DynamicContent">
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
</conditions>
<action type="Rewrite" url="app.js"/>
</rule>
</rules>
</rewrite>

<!-- disable the IIS websocket module to allow node.js to provide its own
WebSocket implementation -->

<webSocket enabled="false" />

</system.webServer>
</configuration>
```


**Setup IIS**
- Open IIS Manager (*Start > Type 'IIS Manager'*)
- Create your new site (*Expand Server > Right click sites > 'Add Websites'*)
- Enter your site's name
- Enter the directory path to your 'client' folder (*C:\example\dist\client\*)
- Enter your hostname (*Your a-record*)
- Leave all other defaults and click 'Ok'

**Start your server**
- Run ```gulp serve:dist```
# Congratulations, you did it! Now go code something awesome!