DeploymentDownloadException Classe

Definição

Indica que houve um erro ao baixar os manifestos ClickOnce ou os arquivos de implantação no computador cliente.Indicates that there was an error downloading either the ClickOnce manifests or the deployment's files to the client computer.

public ref class DeploymentDownloadException : System::Deployment::Application::DeploymentException
[System.Serializable]
public class DeploymentDownloadException : System.Deployment.Application.DeploymentException
type DeploymentDownloadException = class
    inherit DeploymentException
Public Class DeploymentDownloadException
Inherits DeploymentException
Herança
DeploymentDownloadException
Atributos

Exemplos

O exemplo de código a seguir instala uma atualização de aplicativo de forma síncrona e relata ao usuário se houve um problema ao baixar os manifestos ou os arquivos da implantação.The following code example installs an application update synchronously, and reports to the user if there was a problem downloading either the manifests or the deployment's files.

public:
    void LaunchUpdateWithTimeout()
    {
        if (ApplicationDeployment::IsNetworkDeployed)
        {
            ApplicationDeployment^ appDeployment =
                ApplicationDeployment::CurrentDeployment;
            appDeployment->UpdateCompleted +=
                gcnew AsyncCompletedEventHandler(this, 
                &Form1::deploy_UpdateCompleted);

            // The Interval property uses millisecond resolution.
            timer1->Interval = (1000 * 60) * 2;
            timer1->Start();

            appDeployment->UpdateAsync();
        }
    }

private:
    void deploy_UpdateCompleted(Object^ sender,
        AsyncCompletedEventArgs^ e)
    {
        timer1->Stop();
        if (!e->Cancelled)
        {
            if (nullptr == e->Error)
            {
                Application::Restart();
            }
            else
            {
                // Replace with your own error reporting or logging.
                MessageBox::Show(
                    "The update of the application encountered an " +
                    "error. Error message: {0}",
                    e->Error->Message);
            }
        }
        else
        {
            // Replace with your own error reporting or logging.
            MessageBox::Show(
                "The application update was cancelled because the update " +
                "server was unreachable. Please try again later.");
        }
    }

private:
    void timer1_Tick(Object^ sender, EventArgs^ e)
    {
        if (ApplicationDeployment::IsNetworkDeployed)
        {
            ApplicationDeployment::CurrentDeployment->UpdateAsyncCancel();
        }
    }
private void InstallUpdateSync()
{
    if (ApplicationDeployment.IsNetworkDeployed)
    {
        Boolean updateAvailable = false;
        ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;

        try
        {
            updateAvailable = ad.CheckForUpdate();
        }
        catch (DeploymentDownloadException dde)
        {
            // This exception occurs if a network error or disk error occurs
            // when downloading the deployment.
            MessageBox.Show("The application cannt check for the existence of a new version at this time. \n\nPlease check your network connection, or try again later. Error: " + dde);
            return;
        }
        catch (InvalidDeploymentException ide)
        {
            MessageBox.Show("The application cannot check for an update. The ClickOnce deployment is corrupt. Please redeploy the application and try again. Error: " + ide.Message);
            return;
        }
        catch (InvalidOperationException ioe)
        {
            MessageBox.Show("This application cannot check for an update. This most often happens if the application is already in the process of updating. Error: " + ioe.Message);
            return;
        }

        if (updateAvailable)
        {
            try
            {
                ad.Update();
                MessageBox.Show("The application has been upgraded, and will now restart.");
                Application.Restart();
            }
            catch (DeploymentDownloadException dde)
            {
                MessageBox.Show("Cannot install the latest version of the application. Either the deployment server is unavailable, or your network connection is down. \n\nPlease check your network connection, or try again later. Error: " + dde.Message);
            }
            catch (TrustNotGrantedException tnge)
            {
                MessageBox.Show("The application cannot be updated. The system did not grant the application the appropriate level of trust. Please contact your system administrator or help desk for further troubleshooting. Error: " + tnge.Message);
            }
        }
    }
}
Private Sub InstallUpdateSync()
    If (ApplicationDeployment.IsNetworkDeployed) Then
        Dim updateAvailable As Boolean = False
        Dim AD As ApplicationDeployment = ApplicationDeployment.CurrentDeployment

        Try
            updateAvailable = AD.CheckForUpdate()
        Catch dde As DeploymentDownloadException
            ' This exception occurs if a network error or disk error occurs
            ' when downloading the deployment.
            MessageBox.Show("The application cannot check for the existence of a new version at this time. " & ControlChars.Lf & ControlChars.Lf & "Please check your network connection, or try again later. Message: " & dde.Message)
            Exit Sub
        Catch ide As InvalidDeploymentException
            MessageBox.Show("The application cannot check for an update. The ClickOnce deployment is corrupt. Please redeploy the application and try again. Message: " & ide.Message)
            Exit Sub
        Catch ioe As InvalidOperationException
            MessageBox.Show("The application cannot check for an update. This most likely happened because the application is already updating. Message: " & ioe.Message)
            Exit Sub
        End Try

        If (updateAvailable) Then
            Try
                AD.Update()
                MessageBox.Show("The application has been upgraded, and will now restart.")
                Application.Restart()
            Catch dde As DeploymentDownloadException
                MessageBox.Show("Cannot install the latest version of the application. " + ControlChars.Lf + ControlChars.Lf + "Please check your network connection, or try again later.")
            End Try
        End If
    End If
End Sub

Comentários

Um DeploymentDownloadException pode indicar que vários problemas ocorreram quando o usuário tentou baixar uma atualização de ClickOnceClickOnce aplicativo:A DeploymentDownloadException can indicate that a number of problems occurred when the user tried to download a ClickOnceClickOnce application update:

  • A conexão de rede computer's do cliente está inoperante.The client's computer's network connection is down.

  • O servidor Web, o servidor FTP ou o compartilhamento de arquivos que hospeda a atualização não está disponível.The Web server, FTP server, or file share hosting the update is unavailable.

  • Um ou mais dos arquivos na ClickOnceClickOnce implantação não foram encontrados.One or more of the files in the ClickOnceClickOnce deployment was not found.

Para obter informações detalhadas de erro sobre uma exceção, consulte ClickOnceClickOnce o log de erros.To obtain detailed error information about an exception, consult the ClickOnceClickOnce error log. Para obter mais informações, consulte Solucionando problemasde implantações do ClickOnce.For more information, see Troubleshooting ClickOnce Deployments.

Construtores

DeploymentDownloadException()

Inicializa uma nova instância da classe DeploymentDownloadException.Initializes a new instance of the DeploymentDownloadException class.

DeploymentDownloadException(SerializationInfo, StreamingContext)

Inicializa uma nova instância da classe DeploymentDownloadException.Initializes a new instance of the DeploymentDownloadException class.

DeploymentDownloadException(String)

Inicializa uma nova instância da classe DeploymentDownloadException com uma mensagem que descreve a exceção.Initializes a new instance of the DeploymentDownloadException class with a message that describes the exception.

DeploymentDownloadException(String, Exception)

Inicializa uma nova instância da classe DeploymentDownloadException.Initializes a new instance of the DeploymentDownloadException class.

Propriedades

Data

Obtém uma coleção de pares de chave/valor que fornecem informações definidas pelo usuário adicionais sobre a exceção.Gets a collection of key/value pairs that provide additional user-defined information about the exception.

(Herdado de Exception)
HelpLink

Obtém ou define um link para o arquivo de ajuda associado a essa exceção.Gets or sets a link to the help file associated with this exception.

(Herdado de Exception)
HResult

Obtém ou define HRESULT, um valor numérico codificado que é atribuído a uma exceção específica.Gets or sets HRESULT, a coded numerical value that is assigned to a specific exception.

(Herdado de Exception)
InnerException

Obtém a instância Exception que causou a exceção atual.Gets the Exception instance that caused the current exception.

(Herdado de Exception)
Message

Obtém uma mensagem que descreve a exceção atual.Gets a message that describes the current exception.

(Herdado de Exception)
Source

Obtém ou define o nome do aplicativo ou objeto que causa o erro.Gets or sets the name of the application or the object that causes the error.

(Herdado de Exception)
StackTrace

Obtém uma representação de cadeia de caracteres de quadros imediatos na pilha de chamadas.Gets a string representation of the immediate frames on the call stack.

(Herdado de Exception)
TargetSite

Obtém o método que gerou a exceção atual.Gets the method that throws the current exception.

(Herdado de Exception)

Métodos

Equals(Object)

Determina se o objeto especificado é igual ao objeto atual.Determines whether the specified object is equal to the current object.

(Herdado de Object)
GetBaseException()

Quando substituído em uma classe derivada, retorna a Exception que é a causa raiz de uma ou mais exceções subsequentes.When overridden in a derived class, returns the Exception that is the root cause of one or more subsequent exceptions.

(Herdado de Exception)
GetHashCode()

Serve como a função de hash padrão.Serves as the default hash function.

(Herdado de Object)
GetObjectData(SerializationInfo, StreamingContext)

Define o SerializationInfo com informações sobre a exceção.Sets the SerializationInfo with information about the exception.

(Herdado de DeploymentException)
GetType()

Obtém o tipo de runtime da instância atual.Gets the runtime type of the current instance.

(Herdado de Exception)
MemberwiseClone()

Cria uma cópia superficial do Object atual.Creates a shallow copy of the current Object.

(Herdado de Object)
ToString()

Cria e retorna uma representação de cadeia de caracteres da exceção atual.Creates and returns a string representation of the current exception.

(Herdado de Exception)

Eventos

SerializeObjectState

Ocorre quando uma exceção é serializada para criar um objeto de estado de exceção que contém dados serializados sobre a exceção.Occurs when an exception is serialized to create an exception state object that contains serialized data about the exception.

(Herdado de Exception)

Aplica-se a

Veja também