Setup the connection string in web.config

Discussion in 'Site Programming, Development and Design' started by Ray, Dec 17, 2010.

  1. Ray

    Ray

    In IIS 7 Manager there is a module where you can create and define your connection string for your applications web.config file. This module will create the connection string and the connection string name and place it in the proper location within your web.config.
    Utilize this feature follow these steps.

    1. Connect to the web server using IIS 7 Manager.
    2. Go to the “Connection Strings” module and click on Add.
    3. Define the connection string name.
    4. Type the SQL server name your database resides in (i.e. s01.Winhost.com)
    5. Type the Database name.
    6. Click on Specify credentials and click on the Set button.
    7. Input your database user name and database password.
    8. Click OK.​

    In your applications web.config file you will see…

    Code:
        <connectionStrings>
            <add connectionString="Server=[sql server];Database=[DB name];User ID=[DB login];Password=[db password]" name=" conntestname " />
        </connectionStrings>
    </configuration>
    As with all IIS 7 modules you do not need to go through IIS 7 Manager to input these elements and value. You can go directly to your applications web.config file and code them manually. Likewise if you have a connection string in your applications web.config file and you want to impose some modifications to it. You can go to your IIS 7 Manager and connect to our server and go to the module “Connection Strings” to either update the values in the connection string.
     
    Last edited by a moderator: Oct 14, 2015

Share This Page