This entry attempts to cover, from start to finish, how one developer might setup a new development machine with Windows 7, IIS 7.5, SQL 2012, VS 2012, and Team Foundation Cloud Services. I am publishing this because I found many snags along the way with no good answers to be found on the internet in a unified place. SQL and .Net answers rarely seem to meet well. Best practices often get chucked due to frustration.
Environment Assumptions:
Window 7
IIS 7.5
SQL 2012
Visual Studio 2012
Source Control: TFS Cloud Service
Install the Operating System first.
Do all the required windows updates.
Installing IIS
Control Panel -> Programs -> Programs & Features: Turn Windows Features On or Off
Expand Internet Information Services
Match this image
Installing URL Rewrite (click the link and install)
(x86 – 32bit)
http://www.microsoft.com/web/gallery/install.aspx?appid=urlrewrite2
(x63bit)
http://www.microsoft.com/en-us/download/confirmation.aspx?id=7435
Do all the required windows updates.
Installing SQL 2012
Do not install Anaylsis Services or Reporting Services (unless you really work on a system with this…)
Choose Mixed Mode with a “sa” account password
Change the Default Location where the database/logs are stored (probably to you D drive)
Change SQL Server Service to be “automated”
After install, do all the required windows updates.
Restore a backup of SuperAwesomeCompanyWebsite database
Installing the Development Environment
Install Visual Studio 2012
Install Visual Studio Team Foundation Tools
Install SQL Server Data Tools
Do all the required windows updates.
CONFIGURING SuperAwesomeCompanyWebsite: Team Foundation Server (Cloud Service assumed to be setup)
In Visual Studio 2012
Open Team Foundations Browser
Connect to http://SuperAwesomeCompanyWebsite.visualstudio.com\DefaultCollection
Download the project to your computer (suggest a folder like “D:\TFS\ SuperAwesomeCompanyWebsite\”
CONFIGURING SuperAwesomeCompanyWebsite: IIS
Quick Explanation of IIS 7.5 and SuperAwesomeCompanyWebsite
Hierarchy in IIS = Website -> Application (one to many) -> Virtual Directory (one to many)
SuperAwesomeCompanyWebsite only has 1 application, and 1 virtual directory
Open IIS
Go to Default Website
Edit Bindings (right column): Add HTTP/HTTPS; remove all others (unless you really need that stuff…)
Right Click on Default Website -> Add an Application
Use the built in “DefaultAppPool”
Match the images provided:
Click on SuperAwesomeCompanyWebsite -> Authorization Roles
If you like, you may setup the Connection Strings here as well (will modify your web.config)
Informational:
Click on Application Pool: DefaultAppPool and examine the Advanced Settings
Notice its “Identity” is ApplicationPoolIdentity (not Network Service, not Local Service, not custom thingy…)
Quick Explanation of the ApplicationPoolIdentity (new in IIS 7.5) and NetworkService (what you used to see a lot)
ApplicationPoolIdentity: In IIS 7.5, the default Identity for an Application Pool is ApplicationPoolIdentity. ApplicationPoolIdentity represents a Windows user account called “IIS APPPOOL\<AppPoolName>”, which is created when the Application Pool is created, where AppPoolName is the name of the Application Pool. The “IIS APPPOOL\<AppPoolName>” user is by default a member of the IIS_IUSRS group. So you need to grant write access to the IIS_IUSRS group
CONFIGURING SuperAwesomeCompanyWebsite: FOLDER STRUCTURE
Browse to root folder of your TFS project
Right click on the folder -> properties -> security: Edit: Add
Match the image provided
CONFIGURING SuperAwesomeCompanyWebsite: SQL SERVER
In SQL Server SSMS
1. Create SQL Login
Open Security folder (on the same level as the Databases, Server Objects, etc. folders…not the security folder within each individual database)
Right click logins and select “New Login”
In the Login name field, type ‘IISSQL_Account’
Choose SQL Server authentication, set your password
Change Default Database to the Generic database
Click User Mapping
Grant db_datareader, db_datawriter on each database you want.
Leave default schema blank
2. Create SQL User on your SuperAwesomeCompanyWebsite database
Expand your database “SuperAwesomeCompanyWebsite_generic”
Expand: Security -> Users
Right Click Users: Add New User
user name: IISSQL_Account
login name: IISSQL_Account (from step 1)
default schema: leave blank
Membership: db_datareader, db_datawriter
3. Grant permissions to the new Login on your SuperAwesomeCompanyWebsite database
Run this SQL:
GRANT SELECT, EXECUTE, UPDATE, INSERT ON SCHEMA :: dbo TO [IISSQL_Account]
CONFIGURING SuperAwesomeCompanyWebsite: ASP.Net 4 Framework
Tell ASP.Net 4 Framework to take priority with Default website
Open Command Prompt with Administrative Rights
Browse to: C:\Windows\Microsoft.NET\Framework64\v4.0.30319
Run: aspnet_regiis.exe -i
Tell ASP.Net Web Service to start automatically
1) Start–> Administrative Tools –> Services
2) right click over the ASP.NET State Service and click “start”
*additionally you could set the service to automatic so that it will work after a reboot.
Final notes:
This document contains as many of the gotchas and annoying crap that isn’t well organized on the web as I could find.
Obviously you’ll run into your own peculiar problems and I’d be happy if you shared them with me (and their resolution).