Microsoft KB Archive/837981

From BetaArchive Wiki

Article ID: 837981

Article Last Modified on 11/27/2007



APPLIES TO

  • Microsoft Windows Server 2003, Enterprise Edition (32-bit x86)
  • Microsoft Windows Server 2003, Web Edition
  • Microsoft Windows Server 2003, Standard Edition (32-bit x86)




Important This article contains information that shows you how to help to lower security settings or how to turn off security features on a computer. You can make these changes to work around a specific problem. Before you make these changes, we recommend that you evaluate the risks that are associated with implementing this workaround in your particular environment. If you choose to implement this workaround, take any appropriate additional steps to help to protect your system.

Important This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base:

256986 Description of the Microsoft Windows Registry


SUMMARY

This article describes the steps to configure RDS on a computer that is running Microsoft Windows Server 2003. The following are steps in the configuration process:


  • Create a virtual directory on your Web server.
  • Add a Web service extension to your computer that is running Internet Information Service (IIS).
  • Create new keys in the registry database.
  • Make the IIS Web server run in unsafe mode by modifying the msdfmap.ini file, and by using a handle to the server in the code.
  • Verify the RDS configuration by using sample code that you can run to check whether your computer is configured for RDS or not.


IN THIS TASK

INTRODUCTION

This step-by-step article describes how to configure Remote Data Service (RDS) on a computer that is running Microsoft Windows Server 2003. This article also contains the code to verify the RDS configuration.

back to the top

Requirements

This article assumes that you are familiar with the following topics:

  • Data access by using RDS
  • Programming by using Microsoft Visual Basic 6.0

The following list outlines the recommended hardware, software, network infrastructure, and service packs that you need:

  • Microsoft Visual Basic 6.0
  • Microsoft Windows Server 2003

back to the top

Configure RDS

This section describes the configuration steps that you must use to configure RDS on a computer that is running Microsoft Windows Server 2003.

back to the top

Create a Virtual Directory

  1. Click Start, click Run, type inetmgr, and then click OK. The Internet Information Services (IIS) Manager window appears.
  2. In the left pane, locate, and then right-click the Default Web Site node.
  3. Point to New, and then click Virtual Directory. The Virtual Directory Creation Wizard wizard appears.
  4. Click Next.
  5. Type MSADC in the Alias box, and then click Next.
  6. Type System Drive Letter:\Program Files\Common Files\System\msadc in the Path box.


Note System Drive Letter is the placeholder for the letter that is assigned to your system drive where the operating system is installed.

  1. Click Next.
  2. If the following check boxes are not selected, click to select them:
    • Read
    • Run scripts (such as ASP)
    • Execute (such as ISAPI application or CGI)
  3. Click Next.
  4. Click Finish.

back to the top

Add a Web service extension

  1. In the left pane of the Internet Information Services (IIS) Manager window, locate, and then right-click Web Service Extensions.
  2. Click Add a new Web Service Extension. The New Web Service Extension dialog box appears.
  3. Type RDS in the Extension name box, and then click Add. The Add file dialog box appears.
  4. Type System Drive Letter:\Program Files\Common Files\System\msadc\msadcs.dll in the Path to file box, and then click OK.


Note System Drive Letter is the placeholder for the letter that is assigned to your system drive where the operating system is installed.

  1. Click OK.
  2. To enable the extension, click Allow. By default, all the newly created extensions are prohibited.

back to the top

Create keys in the registry

Warning If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.

Note If the following registry keys are already present in the registry database, do not create them again.

  1. Click Start, click Run, type regedit, and then click OK.
  2. In the left pane of Registry Editor, locate, and then right-click the following subkey:HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\W3SVC\Parameters\ADCLaunch
  3. Click New, and then click Key. A new subkey is created under the ADCLaunch subkey.
  4. Rename the subkey that you created in step 3 of the "Create keys in registry" section AdvancedDataFactory.
  5. Repeat step 3 and step 4 of the "Create keys in registry" section to create another subkey under the subkey ADCLaunch.
  6. Rename the subkey that you created after step 6 of the "Create keys in registry" section RDSServer.DataFactory.

back to the top

Run the Web server in an unsafe mode

Warning This workaround may make your computer or your network more vulnerable to attack by malicious users or by malicious software such as viruses. We do not recommend this workaround but are providing this information so that you can choose to implement this workaround at your own discretion. Use this workaround at your own risk.

To use RDS, you must run the Microsoft Internet Information Services (IIS) server in an unsafe mode. To make the IIS server run in an unsafe mode, you must run the Handunsf.reg file that is installed together with the Microsoft Data Access Components (MDAC) Redist Setup Program. However, this file has been removed from MDAC 2.8. By default, MDAC 2.8 is installed together with Microsoft Windows Server 2003. Therefore, the Handunsf.reg file is not available on a computer that is running Microsoft Windows Server 2003.

Therefore, to make the IIS server run in an unsafe mode, administrators of the computer where IIS service is running can use msdfmap.handler in the code and edit the msdfmap.ini file to make the appropriate changes in the msdfmap.ini file so that the application can access the data by using RDS. For additional information about removal of the Handunsf.reg file from MDAC 2.8, click the following article number to view the article in the Microsoft Knowledge Base:

818490 Handunsf.reg file has been removed in MDAC 2.8 Redist Setup for security reasons


back to the top

Verify the RDS configuration

Verification of the RDS configuration is a three-step process. First, you must edit the msdfmap.ini file on the computer that is running Internet Information Service (IIS). Second, you must create a system Data Source Name (DSN) on the computer that is running Internet Information Services (IIS). Third, you must create a standard EXE project in Microsoft Visual Basic 6.0, and verify the functionality of RDS. If RDS is configured correctly on your computer, follow these steps to receive the data from your Microsoft SQL Server server without any error.

  1. Create a system DSN. For additional information about how to create a system DSN, click the following article number to view the article in the Microsoft Knowledge Base:

    300596 How to create a System Data Source Name (DSN) in Windows 2000

    Note This steps in this article that describe how to create a system DSN on a computer that is running Microsoft Windows 2000 can also be used to create a system DSN on a computer that is running Microsoft Windows Server 2003.
  2. Edit the msdfmap.ini file.
    1. Locate the file msdfmap.ini in the System Drive Letter:\Windows folder on your computer.

      Note System Drive Letter is the placeholder for the letter that is assigned to your system drive where the operating system is installed.
    2. Open the msdfmap.ini file in notepad, and paste the following code at the end of the file:

      [connect MyAuthorDatabase]
      Access=ReadWrite
      Connect="DSN=MyDSNName;UID=MyUserID;PWD=MyPassword"
      
      [userlist MyAuthorDatabase]
      Administrator=ReadWrite
      
      [sql MyAuthorById]
      Sql="SELECT * FROM Authors"

      Note MyDSNName is a placeholder for the DSN that you created in step 1, MyUserID is a placeholder for the userid of the user account that has access to your SQL Server server, and MyPassword is a placeholder for the password of the user account.

    3. Save the file.
  3. Create a standard EXE project in Microsoft Visual Basic 6.0.
    1. Start Microsoft Visual Basic 6.0.
    2. Create a Standard EXE project. By default, a form that is named Form1 is created.
    3. In the Project Explorer window, right-click Form1, and then click View Code.
    4. Paste the following code in the code window of the Form1 form:

      Private Sub Form_Load()
          '
          On Error GoTo ErrorHandler
          Dim dc As RDS.DataControl
          Dim rst As ADODB.Recordset
          '
          Set dc = New RDS.DataControl
          dc.Handler = "MSDFMAP.Handler"
          dc.Server = "http://localhost"
          dc.ExecuteOptions = 1
          dc.FetchOptions = 1
          dc.Connect = "Data Source=MyAuthorDatabase"
          dc.SQL = "MyAuthorById"
          ' Wait at least 20 seconds
          dc.InternetTimeout = 200
          dc.Refresh
          Set rst = dc.Recordset
          '
          Do While Not rst.EOF
             Debug.Print rst!au_fname & " " & rst!au_lname
             rst.MoveNext
          Loop
          '
          If rst.State = adStateOpen Then rst.Close
          Set rst = Nothing
          Set dc = Nothing
          Exit Sub
      ErrorHandler:
          ' clean up
          If Not rst Is Nothing Then
              If rst.State = adStateOpen Then rst.Close
          End If
          Set rst = Nothing
          Set dc = Nothing
          
          If Err <> 0 Then
              MsgBox Err.Source & "-->" & Err.Description, , "Error"
          End If
          '
      End Sub
    5. On the Run menu, click Start With Full Compile.

back to the top

REFERENCES

For more information about Remote Data Binding with Remote Data Service, visit the following Microsoft Web site:

For more information about RDS, visit the following Microsoft Developer Network (MSDN) Web site:

For more information, click the following article numbers to view the articles in the Microsoft Knowledge Base:

230680 Working with RDS handlers


251122 Troubleshooting common problems with Remote Data Services


231416 Remote Data Services (RDS) Objects do not maintain state


250536 How to configure RDS for Windows 2000


back to the top

Keywords: kbwizard kbservice kbregistry kbado kbuser kbpasswords kbhowtomaster KB837981