Article ID: 823177 - Last Review: March 22, 2007 - Revision: 4.5 PRB: "System.Net.WebException. The Underlying Connection Was Closed. Could Not Establish Trust Relationship with Remote Server." Error Message When You Upgrade the .NET FrameworkOn This PageSYMPTOMSWhen you install the Microsoft .NET Framework version 1.0 Service Pack 2 or you upgrade
to the .NET Framework version 1.1 from the .NET Framework version 1.0, your Web service clients may receive
the following error message on a call to a Web service. This error message occurs when you use Secure
Socket Layer (SSL). System.Net.WebException. The
underlying connection was closed. Could not establish trust relationship with
remote server. The error message may appear after you install or after you upgrade even though the code works as you expect. CAUSE
Beginning with the .NET
Framework version 1.0 Service Pack 2 and with the .NET
Framework version 1.1 and later, the name that is used on the HTTP request must match
the name of the server that is issued with the SSL certificate. Earlier
SSL certificates may no longer be accepted under certain circumstances. Also, the
Certificate Revocation List (CRL) is now examined to make sure that the
certificate has not been revoked. Other scenarios exist also. For example, some networks use a different name-resolution scheme for internal versus external clients. In cases where the certificate is issued to a server with a public URL (such as www.adatum.com) and with intranet applications, the internal Domain Name System (DNS) Server provides a different name for the same server (such as www.internal.corporate.adatum.com). Requests for this Web service over SSL may fail. This change is made to enhance the security of Web services that use SSL. Note The example companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted herein are fictitious. No association with any real company, organization, product, domain name, e-mail address, logo, person, places, or events is intended or must be inferred. RESOLUTIONYou can resolve this problem by using either of the following methods:
WORKAROUNDTo work around this problem, you can implement
ICertificatePolicy. Then you must pass ICertificatePolicy to ServicePointManager.CertificatePolicy
before the Web Service method call is made. The following code sample is implemented in the client application. The code forces the client application to accept every certificate that the server provides. This method weakens the security of the application because the authentication of the server is bypassed. To safely work around this problem, make sure that the certificate of the server contains the expected name before you allow the connection to continue. The following sample code implements ICertificatePolicy and then accepts every request under SSL: Microsoft Visual Basic .NET Import the following two namespaces, and then implement the class: Import the following two namespaces, and then implement the class: Visual Basic .NET STATUS
This behavior is by design. MORE INFORMATIONSteps to Reproduce the Problem
REFERENCESFor additional information about ASP.NET security enhancements and SSL, visit the following Microsoft Developer Network (MSDN) Web site: http://msdn2.microsoft.com/en-us/library/aa302384.aspx
(http://msdn2.microsoft.com/en-us/library/aa302384.aspx)
For
additional information about configuring ASP.NET and IIS to use SSL, visit the following Microsoft Developer Network (MSDN) Web site:http://msdn2.microsoft.com/en-us/library/aa302411.aspx
(http://msdn2.microsoft.com/en-us/library/aa302411.aspx)
For
additional information about how to add and how to remove Web references, visit the following Microsoft Developer Network (MSDN) Web site:http://msdn2.microsoft.com/en-us/library/d9w023sx(vs.71).aspx
(http://msdn2.microsoft.com/en-us/library/d9w023sx(vs.71).aspx)
| Article Translations
|

Back to the top
