Freigeben über


DiscoveryClientProtocol.Errors-Eigenschaft

Ruft eine Auflistung von Ausnahmen ab, die während des Aufrufs von Methoden aus dieser Klasse aufgetreten sind.

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

Syntax

'Declaration
Public ReadOnly Property Errors As DiscoveryExceptionDictionary
'Usage
Dim instance As DiscoveryClientProtocol
Dim value As DiscoveryExceptionDictionary

value = instance.Errors
public DiscoveryExceptionDictionary Errors { get; }
public:
property DiscoveryExceptionDictionary^ Errors {
    DiscoveryExceptionDictionary^ get ();
}
/** @property */
public DiscoveryExceptionDictionary get_Errors ()
public function get Errors () : DiscoveryExceptionDictionary

Eigenschaftenwert

Ein DiscoveryExceptionDictionary von Ausnahmen.

Hinweise

Die Errors-Auflistung wird mit den Ausnahmen gefüllt, die während des Aufrufs der MethodenDiscover, DiscoverAny, ResolveAll und ResolveOneLevel aufgetreten sind. Das DiscoveryExceptionDictionary wird nach dem Aufrufen dieser Methoden geleert.

Beispiel

Dim myDiscoFile As String = "https://localhost/MathService_vb.vsdisco"
Dim myUrlKey As String = "https://localhost/MathService_vb.asmx?wsdl"
Dim myDiscoveryClientProtocol As New DiscoveryClientProtocol()

' Get the discovery document.
Dim myDiscoveryDocument As DiscoveryDocument = myDiscoveryClientProtocol.Discover(myDiscoFile)
Dim myEnumerator As IEnumerator = myDiscoveryDocument.References.GetEnumerator()
While myEnumerator.MoveNext()
  Dim myContractReference As ContractReference = CType(myEnumerator.Current, ContractReference)
   
  ' Get the DiscoveryClientProtocol from the ContractReference.
   myDiscoveryClientProtocol = myContractReference.ClientProtocol
   myDiscoveryClientProtocol.ResolveAll()

   Dim myExceptionDictionary As DiscoveryExceptionDictionary = myDiscoveryClientProtocol.Errors

   If myExceptionDictionary.Contains(myUrlKey) Then
      Console.WriteLine("System generated exceptions.")
      
      ' Get the exception from the DiscoveryExceptionDictionary.
      Dim myException As Exception = myExceptionDictionary(myUrlKey)
      
      Console.WriteLine(" Source : " & myException.Source)
      Console.WriteLine(" Exception : " & myException.Message)
      Console.WriteLine()
   End If
End While
string myDiscoFile = "https://localhost/MathService_cs.vsdisco";
string myUrlKey = "https://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);
   }
}
   String^ myDiscoFile = "https://localhost/MathService_cs.vsdisco";
   String^ myUrlKey = "https://localhost/MathService_cs.asmx?wsdl";
   DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol;
   
   // Get the discovery document.
   DiscoveryDocument^ myDiscoveryDocument = myDiscoveryClientProtocol->Discover( myDiscoFile );
   IEnumerator^ myEnumerator = myDiscoveryDocument->References->GetEnumerator();
   while ( myEnumerator->MoveNext() )
   {
      ContractReference^ myContractReference = dynamic_cast<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 : {0}", myException->Source );
         Console::WriteLine( " Exception : {0}", myException->Message );
      }
   }
}
String myDiscoFile = "https://localhost/MathService_jsl.vsdisco";
String myUrlKey = "https://localhost/MathService_jsl.asmx?wsdl";
DiscoveryClientProtocol myDiscoveryClientProtocol = 
    new DiscoveryClientProtocol();

// Get the discovery document.
DiscoveryDocument myDiscoveryDocument = myDiscoveryClientProtocol.
    Discover(myDiscoFile);
IEnumerator myEnumerator = myDiscoveryDocument.get_References().
    GetEnumerator();

while (myEnumerator.MoveNext()) {
    ContractReference myContractReference = (ContractReference)
        myEnumerator.get_Current();

    // Get the DiscoveryClientProtocol from the ContractReference.
    myDiscoveryClientProtocol = myContractReference.
        get_ClientProtocol();
    myDiscoveryClientProtocol.ResolveAll();
    DiscoveryExceptionDictionary myExceptionDictionary = 
        myDiscoveryClientProtocol.get_Errors();

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

        // Get the exception from the DiscoveryExceptionDictionary.
        System.Exception myException = myExceptionDictionary.
            get_Item(myUrlKey);
        Console.WriteLine(" Source : " + myException.get_Source());
        Console.WriteLine(" Exception : " + myException.get_Message());
    }
}

Plattformen

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

DiscoveryClientProtocol-Klasse
DiscoveryClientProtocol-Member
System.Web.Services.Discovery-Namespace