none
Arret de service windows inexpliqué... RRS feed

  • Question

  • Je mets en place service windows sur un Windows server 2008 .

    Après avoir ENFIN réussi à l'installé, il tombe sans raison et surtout sans message d'erreur.

    Ce que je ne comprends pas c'est que j'ai trappé toutes les erreurs, j'aurai du avoir un message dans le l'observateur d'événement.

     

    Ce service utilise un Service Web sur un serveur distant (mais dans ce cas précis normalement il ne l'instancie pas).

    Il se connecte à une base SQL SERVER en local.

    Le timer se déclenche toutes les 3 sec  et accede à la meme table .

    le timer marche 2 ou 3 fois et le service tombe sans rien pour m'aider.


    FB

    lundi 5 décembre 2011 14:24

Réponses

Toutes les réponses

  • Bonjour,

    Avez vous essayé de déboguer votre service ?

    Pour savoir comment déboguer un service Windows : http://msdn.microsoft.com/fr-fr/library/7a50syb3(v=VS.100).aspx

     

    Cordialement.

    lundi 5 décembre 2011 14:40
    Auteur de réponse
  • Bonjour,

    pouvez vous nous montrer le code ou vous avez trappé vos erreurs ?

    votre service s'exécute normalement depuis visual studio ?

    avez vous tenter de débugguer votre service installé en vous attachant au process ?

    Cordialement

    lundi 5 décembre 2011 14:43
    Modérateur
  • Tout est la justement. Je suis sur le serveur de mon client et dans mon envirronement TOUT marche. ouinnnnn!!!

    Je n'ai pas Visual Studio sur le serveur. Peut être devrais je installer une version express.

    AccesBase : est une classe qui gère mes accès à ma source de données. Elle est utilisé dans leur intranet et leur extranet depuis plusieurs années et fonctionne TRES bien. 

    BAK : est une classe qui va s'occuper des sauvegarde de la base

    PDF : est une classe qui génère des PDF à partir d'état crystal report

    FTP : est une classe qui s'occupe des flux FTP vers le serveur de publication

       Dim strSource As String = "CatWebService"
    
        Private WithEvents oBAK As BAK = Nothing
        Private WithEvents oPDF As PDF = Nothing
        Private WithEvents oFTP As FTP = Nothing
        Private WithEvents oMAIL As Mail = Nothing
        Private WithEvents accCatWeb As AccesBase = Nothing
        Private accMaster As AccesBase = Nothing
    
        Sub New()
    
            ' Cet appel est requis par le Concepteur Windows Form.
            InitializeComponent()
    
            ' Ajoutez une initialisation quelconque après l'appel InitializeComponent().
            If Not System.Diagnostics.EventLog.SourceExists(strSource) Then
                System.Diagnostics.EventLog.CreateEventSource(strSource, "CatWebService_App")
            End If
            EventLog_S_CatWeb.Source = strSource
            EventLog_S_CatWeb.Log = "CatWebService_App"
            EventLog_S_CatWeb.WriteEntry("CatWebService_App Instancié")
    
        End Sub
    
        Protected Overrides Sub OnStart(ByVal args() As String)
            Try
                Timer1.Enabled = False
                GstrConnectCatWeb = ConfigurationManager.AppSettings("ConnectionCatWeb").Trim
                GstrConnectMaster = ConfigurationManager.AppSettings("ConnectionMaster").Trim
    
                GstrRepertoireBases = ConfigurationManager.AppSettings("RepertoireBases").Trim
                GstrRepertoireLog = ConfigurationManager.AppSettings("RepertoireLog").Trim
                GstrRepertoireReport = ConfigurationManager.AppSettings("RepertoireReport").Trim
                GstrRepertoirePDF_TMP = ConfigurationManager.AppSettings("RepertoirePDF_TMP").Trim
                GstrRepertoirePDF_SITE = ConfigurationManager.AppSettings("RepertoirePDF_SITE").Trim
                GstrRepertoireSauvegarde = ConfigurationManager.AppSettings("RepertoireSauvegarde").Trim
                GstrFTPRepertoireLocal = ConfigurationManager.AppSettings("FTPRepertoireLocal").Trim
                GstrFTPRepertoireLocalPDF = ConfigurationManager.AppSettings("FTPRepertoireLocalPDF").Trim
                GstrFTPRepertoireLocalDump = ConfigurationManager.AppSettings("FTPRepertoireLocalDump").Trim
                GstrFTPRepertoireDistantPDF = ConfigurationManager.AppSettings("FTPRepertoireDistantPDF").Trim
                GstrFTPRepertoireDistantDump = ConfigurationManager.AppSettings("FTPRepertoireDistantDump").Trim
                GstrFTPNomBak = ConfigurationManager.AppSettings("FTPNomBak").Trim
                GstrFTPURL = ConfigurationManager.AppSettings("FTPURL").Trim
                GstrFTPUSER = ConfigurationManager.AppSettings("FTPUSER").Trim
                GstrFTPPWD = ConfigurationManager.AppSettings("FTPPWD").Trim
                GstrFTPDomaine = ConfigurationManager.AppSettings("FTPDomaine").Trim
                GlngBufferSize = CLng(ConfigurationManager.AppSettings("BufferSize").Trim)
    
                GlngMailPort = ConfigurationManager.AppSettings("MailPort").Trim
                GstrMailSMTP = ConfigurationManager.AppSettings("MailSMTP").Trim
                GstrMailDestinataires = ConfigurationManager.AppSettings("MailDestinataires").Trim
                GstrMailExpediteur = ConfigurationManager.AppSettings("MailExpediteur").Trim
                GstrMailLogin = ConfigurationManager.AppSettings("MailLogin").Trim
                GstrMailPassword = ConfigurationManager.AppSettings("MailPassword").Trim
                If ConfigurationManager.AppSettings("EnDebug").Trim.ToLower = "true" Then
                    GbEnDebug = True
                Else
                    GbEnDebug = False
                End If
    
                accCatWeb = New AccesBase(GstrConnectCatWeb)
                If GbEnDebug Then EventLog_S_CatWeb.WriteEntry("CatWeb : " & IIf(accCatWeb Is Nothing, "Erreur !", "Ok"))
                accMaster = New AccesBase(GstrConnectMaster)
                If GbEnDebug Then EventLog_S_CatWeb.WriteEntry("Master : " & IIf(accMaster Is Nothing, "Erreur !", "Ok"))
    
                Timer1.Interval = 3000
                Timer1.Enabled = True
                If GbEnDebug Then EventLog_S_CatWeb.WriteEntry("Timer initialisé")
    
            Catch ex As Exception
                EventLog_S_CatWeb.WriteEntry("Erreur :" & ex.Message, EventLogEntryType.Error, 900)
            End Try
    
        End Sub
    
        Protected Overrides Sub OnStop()
            Timer1.Enabled = False
            accCatWeb.Dispose()
            accMaster.Dispose()
            FermeObject(accCatWeb)
            FermeObject(accMaster)
        End Sub
    
        Private Sub Timer1_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Handles Timer1.Elapsed
    
            Try
                If InitMail() Then
                    Timer1.Enabled = False
    
                    Dim bOk As Boolean = False
                    Dim strRep As String = ""
    
                    'Vérification que des traitement sont à lancer
                    If GbEnDebug Then EventLog_S_CatWeb.WriteEntry("V_Trt_TraitementALancer debut")
                    Dim ds As DataSet = accCatWeb.GetDataSet("Select * from V_Trt_TraitementALancer")
                    If Not ds Is Nothing Then
                        If ds.Tables.Count > 0 Then
                            If GbEnDebug Then EventLog_S_CatWeb.WriteEntry("Dataset initialisé : " & ds.Tables(0).Rows.Count.ToString)
                            Dim dr As DataTableReader = ds.CreateDataReader()
                            If GbEnDebug Then EventLog_S_CatWeb.WriteEntry("DataTableReader créé")
                            If dr.HasRows Then
                                While dr.Read
                                    bOk = True
                                    Select Case dr("Code")
                                        Case "PDF"
    
                                            If GbEnDebug Then EventLog_S_CatWeb.WriteEntry("PDF deb")
    
                                            If Not EstEncoursPDF(dr("idTraitements_Plan")) Then
                                                oPDF.Lancer()
                                            End If
                                            If GbEnDebug Then EventLog_S_CatWeb.WriteEntry("PDF fin")
    
                                        Case "BAK"
                                            If GbEnDebug Then EventLog_S_CatWeb.WriteEntry("BAK deb")
    
                                            If Not EstEncoursBAK(dr("idTraitements_Plan")) Then
                                                oBAK.Lancer()
                                            End If
    
                                            If GbEnDebug Then EventLog_S_CatWeb.WriteEntry("BAK fin")
    
                                        Case "FTP"
                                            If GbEnDebug Then EventLog_S_CatWeb.WriteEntry("FTP deb")
    
                                            Try
                                                Dim strBAKLocal As String = GstrFTPRepertoireLocalDump & "\" & GstrFTPNomBak
                                                strRep = strBAKLocal
                                                bOk = File.Exists(strRep)
                                                If bOk Then
    
                                                    If Not EstEncoursFTP(dr("idTraitements_Plan")) And Not EstEncoursBAK(0) Then
                                                        Dim strBAKDistant As String = GstrFTPRepertoireDistantDump & "/" & GstrFTPNomBak
                                                        strRep = strBAKDistant
                                                        bOk = oFTP.FileExists(strRep)
                                                        If bOk Then
                                                            Dim strBAKDistant_Prec As String = "Prec_" & GstrFTPNomBak
                                                            oFTP.Rename(strBAKDistant, strBAKDistant_Prec)
                                                        End If
                                                        If Not oFTP.ErreurDeclenchee Then
                                                            If oFTP.DirectoryExists(GstrFTPRepertoireDistantDump) Then
                                                                If oFTP.PutFile(strBAKLocal, GstrFTPURL & "/" & strBAKDistant) Then
                                                                    Dim wcf As New CatWebWCF.CatWebWCFClient
                                                                    If wcf.Restaurer() Then
    
                                                                    End If
                                                                End If
                                                            End If
                                                        End If
                                                    End If
    
                                                End If
    
    
                                                Dim fls As String() = Directory.GetFiles(GstrFTPRepertoireLocalPDF, "*.*")
                                                bOk = (fls.Length > 0)
                                                If bOk Then
                                                    If Not EstEncoursFTP(dr("idTraitements_Plan")) And Not EstEncoursPDF(0) Then
                                                        Dim fl As String
                                                        For Each fl In fls
                                                            oFTP.PutFile(fl, GstrFTPURL & "/" & GstrFTPRepertoireDistantPDF & "/" & Path.GetFileName(fl))
                                                            If oFTP.ErreurDeclenchee Then
                                                                Exit For
                                                            End If
                                                        Next
                                                    End If
                                                End If
    
                                                fls = Directory.GetFiles(GstrFTPRepertoireLocal, "*.*")
                                                bOk = (fls.Length > 0)
                                                If bOk Then
                                                    If Not EstEncoursFTP(dr("idTraitements_Plan")) And Not EstEncoursPDF(0) Then
                                                        Dim fl As String
                                                        For Each fl In fls
                                                            oFTP.PutFile(fl, GstrFTPURL & "/" & Path.GetFileName(fl))
                                                            If oFTP.ErreurDeclenchee Then
                                                                Exit For
                                                            End If
                                                        Next
                                                    End If
                                                End If
                                                If GbEnDebug Then EventLog_S_CatWeb.WriteEntry("FTP fin")
    
                                            Catch ex As Exception
                                                TraitementErreur(dr("idTraitements_Plan"), _
                                                                 "FTP : " & strRep & vbCrLf & ex.Message, _
                                                                 3200, True)
                                                bOk = False
                                            End Try
    
    
                                    End Select
    
                                End While
                            End If
                            FermeObject(dr)
                        End If
                    End If
                    FermeObject(ds)
                    Timer1.Enabled = True
                End If
            Catch ex As Exception
                EventLog_S_CatWeb.WriteEntry("Erreur grâve : Service à redémarrer (Tick) " & vbCrLf & ex.Message, EventLogEntryType.Error, 9666)
                Timer1.Enabled = False
                Me.Stop()
            End Try
        End Sub
    
    


    FB
    lundi 5 décembre 2011 15:53
  •     Function TraitementLancement(ByVal idTraitements_Plan As Long, ByVal MsgDebut As String, ByVal CodeErreur As Integer) As Boolean
            Dim cmd As SqlCommand
            Dim Params As SqlParameter()
            Try
                EventLog_S_CatWeb.WriteEntry(MsgDebut, EventLogEntryType.Information, CodeErreur)
                Params = New SqlParameter(0) {}
                Params(0) = New SqlParameter
                Params(0).SqlDbType = SqlDbType.Int
                Params(0).ParameterName = "@idTraitements_Plan"
                Params(0).Value = idTraitements_Plan
                cmd = accCatWeb.GetCommand("TraitementLancement", CommandType.StoredProcedure, Params)
                cmd.CommandTimeout = 600
                cmd.ExecuteScalar()
                cmd.Dispose()
                Erase Params
    
                Return True
    
            Catch ex As Exception
                TraitementErreur(idTraitements_Plan, "Erreur début traitement..." & vbCrLf & ex.Message, 910, True)
    
                Return False
            Finally
                accCatWeb.Disconnect()
            End Try
        End Function
    
        Function TraitementErreur(ByVal idTraitements_Plan As Long, ByVal MsgErreur As String, ByVal CodeErreur As Integer, ByRef ErreurGrave As Boolean) As Boolean
            Dim cmd As SqlCommand
            Dim Params As SqlParameter()
            Dim bReturn As Boolean = False
    
            Try
                EventLog_S_CatWeb.WriteEntry("TraitementErreur - " & Now.ToString("dd/MM/yyyy HH:mm:ss"), EventLogEntryType.Information, 910)
                Params = New SqlParameter(1) {}
                Params(0) = New SqlParameter
                Params(0).SqlDbType = SqlDbType.Int
                Params(0).ParameterName = "@idTraitements_Plan"
                Params(0).Value = idTraitements_Plan
                Params(1) = New SqlParameter
                Params(1).SqlDbType = SqlDbType.Text
                Params(1).ParameterName = "@MsgErreur"
                Params(1).Value = MsgErreur
    
                cmd = accCatWeb.GetCommand("TraitementErreur", CommandType.StoredProcedure, Params)
                cmd.CommandTimeout = 600
                cmd.ExecuteScalar()
                cmd.Dispose()
                Erase Params
                EventLog_S_CatWeb.WriteEntry("Erreur - " & Now.ToString("dd/MM/yyyy HH:mm:ss"), EventLogEntryType.Error, CodeErreur)
    
                bReturn = True
    
            Catch ex As Exception
                EventLog_S_CatWeb.WriteEntry("Erreur TraitementErreur :" & ex.Message, EventLogEntryType.Error, 920)
                ErreurGrave = True
                Return False
            Finally
                accCatWeb.Disconnect()
            End Try
            If ErreurGrave Then
                EventLog_S_CatWeb.WriteEntry("Erreur grâve : Service à redémarrer" & vbCrLf & MsgErreur, EventLogEntryType.Error, 920)
                Timer1.Enabled = False
                Me.Stop()
            End If
    
            oMAIL.strTitre = "ERREUR !!! Traitement'"
            oMAIL.strMessage = MsgErreur
            oMAIL.Lancer()
    
            Return bReturn
        End Function
    
        Function TraitementFinPDF(ByVal idArticle As Long, ByVal idTraitements_Plan As Long) As Boolean
            Dim cmd As SqlCommand
            Dim Params As SqlParameter()
            Dim bReturn As Boolean = False
    
            Try
                Params = New SqlParameter(0) {}
                Params(0) = New SqlParameter
                Params(0).SqlDbType = SqlDbType.Int
                Params(0).ParameterName = "@idArticle"
                Params(0).Value = idArticle
    
                cmd = accCatWeb.GetCommand("TraitementPDFFin", CommandType.StoredProcedure, Params)
                cmd.CommandTimeout = 600
                cmd.ExecuteScalar()
                cmd.Dispose()
                Erase Params
    
                bReturn = True
    
            Catch ex As Exception
                TraitementErreur(idTraitements_Plan, "Erreur TraitementPDFFin :" & ex.Message, 1800, True)
                Return False
            Finally
                accCatWeb.Disconnect()
            End Try
    
            Return bReturn
        End Function
    
        Function TraitementErreurPDF(ByVal idArticle As Long, ByVal idTraitements_Plan As Long) As Boolean
            Dim cmd As SqlCommand
            Dim Params As SqlParameter()
            Dim bReturn As Boolean = False
    
            Try
                Params = New SqlParameter(0) {}
                Params(0) = New SqlParameter
                Params(0).SqlDbType = SqlDbType.Int
                Params(0).ParameterName = "@idArticle"
                Params(0).Value = idArticle
    
                cmd = accCatWeb.GetCommand("TraitementPDFErreur", CommandType.StoredProcedure, Params)
                cmd.CommandTimeout = 600
                cmd.ExecuteScalar()
                cmd.Dispose()
                Erase Params
    
                bReturn = True
    
                Dim mMail As New MailMessage()
    
            Catch ex As Exception
                TraitementErreur(idTraitements_Plan, "Erreur TraitementErreurPDF :" & ex.Message, 1700, True)
                Return False
            Finally
                accCatWeb.Disconnect()
            End Try
    
            Return bReturn
        End Function
    
        Function TraitementFin(ByVal idTraitements_Plan As Long, ByVal MsgFin As String, ByVal CodeErreur As Integer) As Boolean
            Dim cmd As SqlCommand
            Dim Params As SqlParameter()
            Dim bReturn As Boolean = False
            Try
                Params = New SqlParameter(1) {}
                Params(0) = New SqlParameter
                Params(0).SqlDbType = SqlDbType.Int
                Params(0).ParameterName = "@idTraitements_Plan"
                Params(0).Value = idTraitements_Plan
                Params(1) = New SqlParameter
                Params(1).SqlDbType = SqlDbType.Text
                Params(1).ParameterName = "@MsgFin"
                Params(1).Value = MsgFin
    
                cmd = accCatWeb.GetCommand("TraitementFin", CommandType.StoredProcedure, Params)
                cmd.CommandTimeout = 600
                cmd.ExecuteScalar()
                cmd.Dispose()
                Erase Params
                EventLog_S_CatWeb.WriteEntry("TraitementFin - " & Now.ToString("dd/MM/yyyy HH:mm:ss"), EventLogEntryType.Information, 910)
    
                oMAIL.strTitre = "Fin traitement'"
                oMAIL.strMessage = MsgFin
                oMAIL.Lancer()
    
                bReturn = True
    
            Catch ex As Exception
                TraitementErreur(idTraitements_Plan, "Erreur Après fin traitement..." & vbCrLf & ex.Message, CodeErreur, True)
            Finally
                accCatWeb.Disconnect()
            End Try
    
            Return bReturn
        End Function
    
    
        Private Sub oBAK_InitCompleted(ByVal idTraitements_Plan As Long, ByVal CodeErreur As Integer, ByRef Cancel As Boolean, ByVal sender As Object) Handles oBAK.InitCompleted
            Try
    
                Dim strRep As String
                Dim bOk As Boolean = False
                Cancel = True
                Dim o As BAK = DirectCast(sender, BAK)
    
                EventLog_S_CatWeb.WriteEntry("BAK Init deb")
    
                Dim strRepNomSauv As String = "CatWeb_" & WeekdayName(Weekday(Now) - 1) & "_" & idTraitements_Plan & ".bak"
                strRepNomSauv = GstrRepertoireSauvegarde & "\" & strRepNomSauv
                Dim strRepNomFTP As String = GstrFTPRepertoireLocalDump & "\" & GstrFTPNomBak
    
                strRep = GstrRepertoireBases
                bOk = Directory.Exists(strRep)
                o.strRepBase = strRep
                If bOk Then
                    strRep = GstrRepertoireSauvegarde
                    bOk = Directory.Exists(strRep)
                    If bOk Then
                        strRep = strRepNomSauv
                        If File.Exists(strRep) Then
                            File.Delete(strRep)
                        End If
                        o.strRepNomSauv = strRep
    
                        If bOk Then
                            strRep = GstrFTPRepertoireLocalDump
                            bOk = Directory.Exists(strRep)
                            If bOk Then
                                strRep = strRepNomFTP
                                If File.Exists(strRep) Then
                                    File.Delete(strRep)
                                End If
                                o.strRepNomFTP = strRep
                            End If
                            o.idCatalogue = accCatWeb.GetIdCatalogueEnCours()
                            Cancel = False
                        End If
                    End If
                End If
    
                EventLog_S_CatWeb.WriteEntry("BAK Init fin")
    
            Catch ex As Exception
                Cancel = True
                TraitementErreur(idTraitements_Plan, _
                                 "Initialisation Publication échouée" & vbCrLf & ex.Message, _
                                 2020, True)
            End Try
        End Sub
    
        Private Sub oBAK_Debut(ByVal idTraitements_Plan As Long, ByVal MsgDebut As String, ByVal CodeErreur As Integer, ByRef Cancel As Boolean, ByVal sender As Object) Handles oBAK.Debut
            Cancel = Not TraitementLancement(idTraitements_Plan, MsgDebut, CodeErreur)
        End Sub
    
        Private Sub oBAK_Erreur(ByVal idTraitements_Plan As Long, ByVal MsgErreur As String, ByVal CodeErreur As Long, ByVal ErreurGrave As Boolean, ByVal sender As Object) Handles oBAK.Erreur
            Try
                TraitementErreur(idTraitements_Plan, _
                                MsgErreur, _
                                CodeErreur, ErreurGrave)
            Catch ex As Exception
    
            End Try
        End Sub
    
        Private Sub oBAK_Fin(ByVal idTraitements_Plan As Long, ByVal MsgFin As String, ByVal CodeErreur As Integer, ByRef Cancel As Boolean, ByVal sender As Object) Handles oBAK.Fin
            TraitementFin(idTraitements_Plan, MsgFin, CodeErreur)
            oBAK.Dispose()
        End Sub
    
    
        Private Sub oPDF_Debut(ByVal idTraitements_Plan As Long, ByVal MsgDebut As String, ByVal CodeErreur As Integer, ByRef Cancel As Boolean, ByVal sender As Object) Handles oPDF.Debut
            Cancel = Not TraitementLancement(idTraitements_Plan, MsgDebut, 1100)
        End Sub
    
        Private Sub oPDF_Erreur(ByVal idTraitements_Plan As Long, ByVal MsgErreur As String, ByVal CodeErreur As Long, ByVal ErreurGrave As Boolean, ByVal sender As Object) Handles oPDF.Erreur
            Try
                TraitementErreur(idTraitements_Plan, _
                                MsgErreur, _
                                CodeErreur, ErreurGrave)
            Catch ex As Exception
    
            End Try
        End Sub
    
        Private Sub oPDF_Fin(ByVal idTraitements_Plan As Long, ByVal MsgFin As String, ByVal CodeErreur As Integer, ByRef Cancel As Boolean, ByVal sender As Object) Handles oPDF.Fin
            TraitementFin(idTraitements_Plan, MsgFin, CodeErreur)
            Microsoft.VisualBasic.FileIO.FileSystem.CopyDirectory(GstrRepertoirePDF_TMP, GstrRepertoirePDF_SITE, True)
            Microsoft.VisualBasic.FileIO.FileSystem.CopyDirectory(GstrRepertoirePDF_TMP, GstrFTPRepertoireLocalPDF, True)
    
            For Each foundFile As String In My.Computer.FileSystem.GetFiles(GstrRepertoirePDF_TMP,FileIO.SearchOption.SearchAllSubDirectories, "*.*")
                Microsoft.VisualBasic.FileIO.FileSystem.DeleteFile(foundFile, FileIO.UIOption.AllDialogs, Microsoft.VisualBasic.FileIO.RecycleOption.DeletePermanently)
            Next
    
            oPDF.Dispose()
        End Sub
    
        Private Sub oPDF_FinArticle(ByVal idTraitements_Plan As Long, ByVal idArticle As Long, ByRef Cancel As Boolean, ByVal sender As Object) Handles oPDF.FinArticle
            Cancel = Not TraitementFinPDF(idArticle, idTraitements_Plan)
        End Sub
    
        Private Sub oPDF_Init(ByVal idTraitements_Plan As Long, ByVal CodeErreur As Integer, ByRef Cancel As Boolean, ByVal sender As Object) Handles oPDF.InitCompleted
            Try
    
    
                Dim strRep As String
                Dim bOk As Boolean
                Dim o As PDF = DirectCast(sender, PDF)
    
                strRep = GstrRepertoirePDF_TMP
                If File.Exists(strRep & "\*.*") Then
                    FileSystem.Kill(strRep & "\*.*")
                End If
                o.strRepPDF = strRep
    
                strRep = GstrRepertoireReport
                bOk = Directory.Exists(strRep)
                If bOk Then
                    o.strRepReport = strRep
                    strRep = GstrRepertoirePDF_SITE
                    If Not Directory.Exists(strRep) Then
                        Directory.CreateDirectory(strRep)
                    End If
    
                    strRep = GstrFTPRepertoireLocalPDF
                    If Not Directory.Exists(strRep) Then
                        Directory.CreateDirectory(strRep)
                    End If
    
                    o.strBase = GstrBase
                    o.strServeur = GstrServeur
                End If
    
            Catch ex As Exception
                Cancel = True
                TraitementErreur(idTraitements_Plan, _
                                 "Initialisation PDF échouée" & vbCrLf & ex.Message, _
                                 1020, True)
            End Try
        End Sub
    
        Function EstEncoursFTP(ByVal idTraitements_Plan As Long) As Boolean
            Dim bReturn As Boolean = False
            Try
                Dim Arecreer As Boolean = False
                If oFTP Is Nothing Then
                    Arecreer = True
                Else
                    Arecreer = oFTP.ErreurDeclenchee
                End If
                If Arecreer Then
                    oFTP = New FTP(idTraitements_Plan, GstrFTPURL, GstrFTPUSER, GstrFTPPWD, GstrFTPDomaine)
                    oFTP.BufferSize = GlngBufferSize
                End If
                Return (oFTP.EnCours Or oFTP.ErreurDeclenchee)
            Catch ex As Exception
    
            End Try
    
            Return bReturn
        End Function
    
        Function EstEncoursPDF(ByVal idTraitements_Plan As Long) As Boolean
            Dim bReturn As Boolean = False
            Try
                If InitPDF() Then
                    If oPDF Is Nothing Then
                        If idTraitements_Plan > 0 Then
                            oPDF = New PDF(accCatWeb, accMaster, idTraitements_Plan)
                        End If
                    Else
                        bReturn = oPDF.EnCours
                    End If
                End If
            Catch ex As Exception
            End Try
    
            Return bReturn
    
        End Function
    
        Function EstEncoursBAK(ByVal idTraitements_Plan As Long) As Boolean
            Dim bReturn As Boolean = False
            Try
                If oBAK Is Nothing Then
                    If idTraitements_Plan > 0 Then
                        oBAK = New BAK(accCatWeb, accMaster, idTraitements_Plan)
                    End If
                Else
                    bReturn = oBAK.EnCours
                End If
            Catch ex As Exception
            End Try
    
            Return bReturn
        End Function
    
        Private Sub oFTP_Erreur(ByVal idTraitements_Plan As Long, ByVal MsgErreur As String, ByVal CodeErreur As Long, ByVal ErreurGrave As Boolean, ByVal sender As Object) Handles oFTP.Erreur
            Try
                oFTP.ErreurDeclenchee = True
                TraitementErreur(idTraitements_Plan, _
                                MsgErreur, _
                                CodeErreur, ErreurGrave)
            Catch ex As Exception
    
            End Try
    
        End Sub
    
        Private Sub oFTP_FinPut(ByVal FicOrigine As String, ByVal sender As Object) Handles oFTP.FinPut
            Try
                oFTP.EnCours = False
                File.Delete(FicOrigine)
            Catch ex As Exception
                oFTP.ErreurDeclenchee = True
            End Try
    
        End Sub
    
        Private Sub accCatWeb_Erreur(ByVal MsgErreur As String, ByVal ex As System.Exception) Handles accCatWeb.Erreur
            Dim strMess As String
            strMess = "Erreur SQL - " & Now.ToString("dd/MM/yyyy HH:mm:ss") & vbCrLf & MsgErreur & vbCrLf & ex.Message
            EventLog_S_CatWeb.WriteEntry(strMess, EventLogEntryType.Error, 988)
            Timer1.Enabled = False
    
        End Sub
    
        Function InitPDF() As Boolean
            Dim bReturn As Boolean = False
            Try
                If GstrServeur = "" Or GstrBase = "" Then
                    accCatWeb.Connect()
                    GstrServeur = accCatWeb.GetConnection.DataSource
                    GstrBase = accCatWeb.GetConnection.Database
                    If GbEnDebug Then EventLog_S_CatWeb.WriteEntry("Serveur : " & GstrServeur)
                    If GbEnDebug Then EventLog_S_CatWeb.WriteEntry("Base : " & GstrBase)
                    accCatWeb.Disconnect()
                End If
                bReturn = True
            Catch ex As Exception
                EventLog_S_CatWeb.WriteEntry("Erreur grâve : initialisation PDF " & vbCrLf & ex.Message, EventLogEntryType.Error, 9666)
                Timer1.Enabled = False
                Me.Stop()
            End Try
            Return bReturn
        End Function
    
    
        Function InitMail() As Boolean
            Dim bReturn As Boolean = False
            Try
                If oMAIL Is Nothing Then
    
                    'EventLog_S_CatWeb.WriteEntry("oMAIL deb")
                    oMAIL = New Mail
                    oMAIL.Port = GlngMailPort
                    oMAIL.strSMTP = GstrMailSMTP
                    oMAIL.strDestinataires = GstrMailDestinataires
                    oMAIL.strExpediteur = GstrMailExpediteur
                    oMAIL.strLogin = GstrMailLogin
                    oMAIL.strPassword = GstrMailPassword
                    If GbEnDebug Then EventLog_S_CatWeb.WriteEntry("Mail initialisé")
    
                End If
                bReturn = True
            Catch ex As Exception
                EventLog_S_CatWeb.WriteEntry("Erreur grâve : initialisation mail " & vbCrLf & ex.Message, EventLogEntryType.Error, 9666)
                Timer1.Enabled = False
                Me.Stop()
            End Try
            Return bReturn
        End Function
    
    
    


    FB
    lundi 5 décembre 2011 15:53
  • PB résolu, crystal était mal installé.
    FB
    mardi 6 décembre 2011 14:11