You receive a "General network error" error message when you make a request to an SQL adapter

Symptoms

When you use an encrypted channel (for example, a connection that uses the HTTPS protocol) to make a request to a Microsoft SQL adapter, the SQL adapter may return the following error message:

General network error. Check your network documentation.

Cause

When you use an encrypted channel to make a request to an SQL adapter, if the SQL adapter connects to an instance of SQL Server that is not configured to handle Secure Socket Layer (SSL) communication, you notice the error that is mentioned in the "Symptoms" section of this article.

Resolution

To resolve this problem, when you use an encrypted channel to make a request to an SQL adapter, make sure that the instance of SQL Server is configured to handle SSL communication.

Status

This behavior is by design.

More Information

Steps to reproduce the behavior

  1. Create a virtual directory, and then enable SSL communication for the virtual directory.
    For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

    298805 How to enable SSL for all customers who interact with your Web site in Internet Information Services

  2. Start Microsoft Visual Studio .NET or Microsoft Visual Studio 2005.
  3. On the File menu, point to
    New, and then click Project.

    Note In Microsoft Visual Studio 2005, on the File menu, point to
    New, and then click Web Site.
  4. Under Project Types, click Visual C# Projects or click Visual Basic Projects.

    Note In Microsoft Visual Studio 2005, under Templates, click ASP.NET Web Site.
  5. Under Templates, click ASP.NET Web Application.

    Note In Microsoft Visual Studio 2005, select Visual C# or Visual Basic in the Language box.
  6. In the Location box, type
    https://ServerName/AspWebSecureTest, and then click OK.

    Note In Microsoft Visual Studio 2005, in the Location box, select HTTP, type
    https://ServerName/AspWebSecureTest, and then click OK.
    • ServerName is a placeholder for the name of a Web server.
    • AspWebSecureTest is the name of a sample ASP.NET Web Application project.
  7. If you are using Microsoft Visual C# .NET, in the WebForm1.aspx.cs file, add the following code
    using System.Data.SqlClient
    before
    using System;
    If you are using Microsoft Visual Basic .NET, in the WebForm1.aspx.vb file, add the following code as the first statement of the file:
    Imports System.Data.SqlClient
  8. Add a Button control and a Label control to the
    WebForm1.aspx form.

    Note In Microsoft Visual Studio 2005, add a Button control and a Label control to the
    Default.aspx form.
  9. Set the ID property of the Label control to Result.
  10. In the Click event handler of the Button control, add the following code.

    Note Replace ServerName with the name of an instance of SQL Server, and replace UserID and
    Password with appropriate values for a user who has credentials to access the instance of SQL Server.

    Visual C# .NET code
    try
    {
    // Use appropriate values for ServerName, UserID, and Password.
    SqlConnection sConn = new SqlConnection ("server=ServerName;database=Northwind;user id=UserID;password=Password;");
    string query = "Select * from categories";
    SqlDataAdapter oAdapter = new SqlDataAdapter (query, sConn);
    DataSet ds = new DataSet();
    oAdapter.Fill(ds, "category");
    Result.Text += ": No Error";
    }
    catch (SqlException Ex)
    {
    Result.Text += ": Error "+Ex.Message;
    }
    Visual Basic .NET code
    Dim sConn As SqlConnection
    Dim query As String
    Dim oAdapter As SqlDataAdapter
    Dim ds As DataSet
    Try
    ' Use appropriate values for ServerName, UserID, and Password.
    sConn = New SqlConnection("server=ServerName;database=Northwind;user id=UserID;password=Password;")
    query = "Select * from categories"
    oAdapter = New SqlDataAdapter(query, sConn)
    ds = New DataSet
    oAdapter.Fill(ds, "category")
    Result.Text += ": No Error"
    Catch exp As SqlException
    Result.Text += ": Error " + exp.Message
    End Try
  11. On the Debug menu, click
    Start.
  12. In the browser window that appears, click the button. You may notice the error that is mentioned in the "Symptoms" section of this article.

References

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

276553 How to enable SSL encryption for SQL Server 2000 with Certificate Server

298805 How to enable SSL for all customers who interact with your Web site in Internet Information Services

BUG #: 8827 (Content Maintenance)
Propriedades

ID do Artigo: 826829 - Última Revisão: 23 de mar de 2009 - Revisão: 1

Comentários