Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

How to: Specify Database Connection Strings in a web.config File

When you install Mobile Development Tools – Server Components, you can specify database connection strings for the deployment and logging Web services. You can view these settings or modify them at a later time by editing the web.config file or using Internet Information Services (IIS) Manager.

SQL Server and IIS Server can be located on the same physical computer or different physical computers. In each case, you can use either Windows authentication or SQL authentication to communicate between servers; however, Windows authentication is recommended in both cases.

In the case where SQL Server and IIS Server are located on different physical computers, use Windows authentication with the Kerberos authentication protocol. For more information, see the Security section in this topic.

The following examples show the connection string format for each type of authentication.

Windows authentication:

Integrated Security=SSPI;Initial Catalog=database name;Data Source=server name;

SQL authentication:

Password=SQL Server user password;User ID=SQL Server user name;Initial Catalog=database name;Data Source=server name;

To modify a database connection string

  1. Open the web.config file for the Web service that you want to modify.

    The web.config file is found in the virtual folder for the Web service, such as c:\inetpub\wwwroot\LoggingService.

  2. Locate the <connectionStrings> element.

  3. In the <add> element, set the connectionString attribute to the new connection string.

    For example, to change the server name, in the connectionString attribute, change the value of the Data Source string.

Security

  • Once Mobile Development Tools – Server Components is deployed to the production environment, the web.config file should be encrypted. You can either encrypt this file during installation, or after you have finished configuring your mobile solution. For more information, see How to: Encrypt a web.config File.

  • Use Windows authentication with the Kerberos authentication protocol when SQL Server and IIS Server are located on different physical computers. For more information about the Kerberos authentication protocol, see Microsoft Kerberos and Windows 2000 Kerberos Authentication. The information provided in the second article also applies to Window Server 2003.

See Also

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.