DiscoveryClientProtocol.Errors Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

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 = 
IEnumerator myEnumerator = 
while ( myEnumerator.MoveNext() )
   ContractReference myContractReference =

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

   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
Available since 1.1
Return to top