Single connection string for Multiple developers

Our development team has been growing as new capabilities and features are being added. Having to deal with web.config changes and TFS can become frustrating so here's what we found to be the easiest solution without having to manage several *.config files (and additional accompanying sub-config files) and having to deal with what to check-in to TFS and what not to.

Database Alias to the rescue...ask each developer on your team to do the following:

STEP 1 - Run SQL Server Configuration Manager 

STEP 2 - Check that SQL Server Browsing is running
- click on SQL Server Services
check that  SQL Server Browsing  is set to   Automatic 
   - double click > go to Service > change Start to Automatic > Click OK 

STEP 3 - Get the TCP/IP Port Number
- Under SQL Server Network Configuration, click on Protocols for ...
 TCP/IP  should be  Enabled 
 IPAll  should be  Yes 
- double click > go to IP Addresses > scroll to the very bottom > under IPAll > copy the  TCP Dynamic Ports number 

Note: Depending on your SQL Server installation, the port just might be the default SQL Server port 1433

STEP 4 - Add a local db Alias 
Note: repeat for 32 and 64 bit
- go to SQL Native 11.0 Configuration
- right-click Aliases and create a new Alias
 Alias Name  =  LOCALDEV  (this will be the common Data Source for all developers)
 Port No  = paste the  TCP Dynamic Ports number  from STEP 3
 Protocol  =  TCP/IP 
 Server  = your local  SQL Server instance name  (this is your existing connection string Data Source or SQL Server Management Studio Server Name)

Replace your connection string Data Source name with  LOCALDEV , check it in to TFS and you're good to go.

Thanks for visiting!

[original publish date: 07/11/16]

Comments

Popular posts from this blog

ASP.NET Identity Remember Me

IIS Express Client Certificates

ASP.NET MVC - How to enable/disable CaC/Client Certificate authentication per area or route.