Export (0) Print
Expand All

DiscoveryClientProtocol.Errors Property

Gets a collection of exceptions that occurred during invocation of method from this class.

Namespace:  System.Web.Services.Discovery
Assembly:  System.Web.Services (in System.Web.Services.dll)

public DiscoveryExceptionDictionary Errors { get; }

The Errors collection is populated with exceptions that occurred during invocations to the Discover, DiscoverAny, ResolveAll, and ResolveOneLevel methods. The DiscoveryExceptionDictionary is cleared on invocation of these methods.

string myDiscoFile = "http://localhost/MathService_cs.vsdisco";
string myUrlKey = "http://localhost/MathService_cs.asmx?wsdl";
DiscoveryClientProtocol myDiscoveryClientProtocol = 
      new DiscoveryClientProtocol();

// Get the discovery document.
DiscoveryDocument myDiscoveryDocument = 
   myDiscoveryClientProtocol.Discover(myDiscoFile);
IEnumerator myEnumerator = 
      myDiscoveryDocument.References.GetEnumerator();
while ( myEnumerator.MoveNext() )
{
   ContractReference myContractReference =
      (ContractReference)myEnumerator.Current;

   // Get the DiscoveryClientProtocol from the ContractReference.
   myDiscoveryClientProtocol = myContractReference.ClientProtocol;
   myDiscoveryClientProtocol.ResolveAll();

   DiscoveryExceptionDictionary myExceptionDictionary 
      = myDiscoveryClientProtocol.Errors;

   if (myExceptionDictionary.Contains(myUrlKey))
   {
      Console.WriteLine("System generated exceptions.");

      // Get the exception from the DiscoveryExceptionDictionary.
      Exception myException = myExceptionDictionary[myUrlKey];

      Console.WriteLine(" Source : " + myException.Source);
      Console.WriteLine(" Exception : " + myException.Message);
   }
}

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft