Delay in creating internal document through V9 engines

3

Good afternoon, I have a web application to create internal documents in Spring ERP. The problem is that each document takes, on average, 2 to 3 minutes to be created. When the document has 1 or 2 lines it takes but creates, but when it takes more time to give the error: "The time limit for the request has expired.". Does anyone know why this happens? Is there any way to optimize the code / some configuration in IIS that solves the problem?

Here is the code:

    Dim documento As New GcpBEDocumentoInterno
    documento.Tipodoc = "RI"
    documento.Entidade = "001"
    documento.TipoEntidade = "F"
    documento.Serie = "2018"
    If Len(txtObs.Text) > 0 Then
        documento.Observacoes = txtObs.Text
    End If
    documento.DataEntrega = timePicker1.Value
    PriEngine.Engine.Comercial.Internos.PreencheDadosRelacionados(documento)
    For Each row As GridViewRow In gvLinhas.Rows
        Dim linhas As New GcpBELinhasDocumentoInterno()
        PriEngine.Engine.Comercial.Internos.AdicionaLinha(documento, row.Cells(0).Text,,,,,, Convert.ToDouble(row.Cells(2).Text))
    Next
    Try
        PriEngine.Engine.Comercial.Internos.Actualiza(documento)
    Catch ex As Exception
        ClientScript.RegisterStartupScript(Me.GetType(), "alert", "alert(""" & "Não foi possivel gravar o documento. "");", True)
    End Try

Thank you very much.

    
asked by anonymous 12.11.2018 / 15:48

1 answer

2

When using Interops in the Web environment, running in, for example, IIS (or identical service), it is recommended that the CacheActiva property of the engine be set to False , so that < in> cache across the engines:

Dim Motor As ErpBS

Set Motor = New ErpBS

Motor.AbreEmpresaTrabalho(TipoPlataforma, Empresa, Utilizador, Password, Transacao, Instancia, ModoPrimario)
Motor.CacheActiva = False

The% w / w of the IDE will not detect the property because it is "hidden", but can be used in the same way.

Another important point is the opening / closing of a company and / or platform, which should be limited to the minimum possible.

Note that when working with COM objects, we should always free the memory after use:

If Marshal.IsComObject(objeto) Then
    Marshal.ReleaseComObject(objeto)
End If
    
14.11.2018 / 11:52