Entity Framework : “The underlying provider failed on Open”

前端 未结 6 1798
隐瞒了意图╮
隐瞒了意图╮ 2021-02-13 00:20

When I try to insert a record, I get this error : The underlying provider failed on Open. This error occurs only with IIS and not with VWD 2008\'s webserver. In the EventViewer

6条回答
  •  花落未央
    2021-02-13 00:41

    Maybe it's too late to answer but i had the same problem.

    I added scope timeout (5 minutes). I let an example.

    Dim varIntervalo As New TimeSpan(0, 5, 0)
    Using varTransaccion As New TransactionScope(TransactionScopeOption.Required, varIntervalo)
        For vari As Integer = 2 To varMatrizDatos.GetUpperBound(0)
            Dim varWhateverAs New TABLE
            varWhatever.ID_TABLE = something
            varWhatever.DESC_TABLE = something else
            varWhatever.DATE_TABLE = CDate(Now.Date)
    
            varEntidades.AddToTABLESet(varWhatever)
            varEntidades.SaveChanges()
        Next
        varTransaccion.Complete()
    End Using
    

    Maybe this code could be improve.

提交回复
热议问题