указанное приведение недопустимо при разработке, но не на тестовом сервере - PullRequest
0 голосов
/ 01 сентября 2010

У меня есть решение .Net 2 с некоторыми классическими страницами asp.

При получении доступа к странице на моем локальном компьютере я получаю указанную неверную ошибку. Ниже функция vb, где я получаю сообщение об ошибке:

    Public Function Retrieve(ByVal vntSeqId As String, ByRef vntPart As String, ByRef vntPartKey As String, ByRef vntEntDate As String _
    , ByRef vntStatus As String, ByRef vntOrigGblId As String, ByRef vntOrigNetId As String, ByRef vntOrigName As String, ByRef vntOrigPhone As String _
    , ByRef vntOrigMs As String, ByRef vntReqType As String, ByRef vntPriority As String, ByRef vntAudBldg As String, ByRef vntRemarks As String _
    , ByRef vntMbldg As String, ByRef vntTlStk As String, ByRef vntTlDef As String, ByRef vntTlAud As String, ByRef vntOrdPend As String _
    , ByRef vntAction As String, ByRef vntCompGblId As String, ByRef vntCompNetId As String, ByRef vntCompName As String, ByRef vntCompPhone As String _
    , ByRef vntCompMs As String, ByRef vntActTk As String, ByRef vntComp As String, ByRef vntCompDate As String, ByRef vntOffHold As String _
    , ByRef vntQtyShp As String, ByRef vntShpDt As String, ByRef vntCartons As String, ByRef vntComments As String, ByRef vntRowlock As String _
    , ByRef vntOnHoldDt As String, ByRef vntOnHoldGblId As String, ByRef vntOffHoldDt As String, ByRef vntOffHoldGblId As String, ByRef vntOnHoldName As String _
    , ByRef vntOffHoldName As String, ByRef vntStatDesc As String, ByRef vntReqTypeDesc As String, ByRef vntPriorDesc As String, ByRef vntAudBldgDesc As String _
    , ByRef vntActionDesc As String, ByRef vntActTkDesc As String, ByRef vntDateCde As String, ByRef strSamplingPlan As String, ByRef vntFO As String _
    , ByRef vntPO As String, ByRef vntIblId As String, ByRef vntOnHoldNetId As String, ByRef vntOffHoldNetId As String, ByRef vntOrigEmail As String _
    , ByRef vntCompEmail As String, ByRef vntTlHold As String, ByRef vntImportAuditInd As String _
    , ByRef vntErrorNumber As Integer, ByRef vntErrorDesc As String) As Boolean


        On Error GoTo ErrorHandler

        Dim blnRC As Boolean
        Dim vntTemp As String = String.Empty
        Dim intCount As Integer
        Dim vntPrcntPcs As String
        Dim vntSampPlan As String

        If vntSeqId = "" Then
            Err.Raise(267, , "Sequence ID not specified")
        End If

        Dim objCallSP As New clsCallSP
        blnRC = objCallSP.CallSP("QneEngAudit.RetrieveAudit", vntErrorNumber, vntErrorDesc _
            , "I", vntSeqId _
            , "O", vntPart, "O", vntPartKey, "O", vntEntDate, "O", vntStatus, "O", vntOrigGblId, "O", vntOrigNetId, "O", vntReqType _
            , "O", vntPriority, "O", vntAudBldg, "OL", vntRemarks, "O", vntMbldg, "O", vntTlStk, "O", vntTlDef, "O", vntTlAud, "O", vntOrdPend _
            , "O", vntAction, "O", vntCompGblId, "O", vntActTk, "O", vntComp, "O", vntCompDate, "O", vntOffHold, "O", vntQtyShp, "O", vntShpDt _
            , "O", vntCartons, "OL", vntComments, "O", vntRowlock, "O", vntOnHoldDt, "O", vntOnHoldGblId, "O", vntOffHoldDt _
            , "O", vntOffHoldGblId, "O", vntImportAuditInd)
        If Not (blnRC AndAlso vntErrorNumber = 0) Then
            Err.Raise(vntErrorNumber, , vntErrorDesc)
        End If

        vntPart = objCallSP.OutParams(0)
        vntPartKey = objCallSP.OutParams(1)
        vntEntDate = objCallSP.OutParams(2)
        vntStatus = objCallSP.OutParams(3)
        vntOrigGblId = objCallSP.OutParams(4)
        vntOrigNetId = objCallSP.OutParams(5)
        vntReqType = objCallSP.OutParams(6)
        vntPriority = objCallSP.OutParams(7)
        vntAudBldg = objCallSP.OutParams(8)
        vntRemarks = objCallSP.OutParams(9)
        vntMbldg = objCallSP.OutParams(10)
        vntTlStk = objCallSP.OutParams(11)
        vntTlDef = objCallSP.OutParams(12)
        vntTlAud = objCallSP.OutParams(13)
        vntOrdPend = objCallSP.OutParams(14)
        vntAction = objCallSP.OutParams(15)
        vntCompGblId = objCallSP.OutParams(16)
        vntActTk = objCallSP.OutParams(17)
        vntComp = objCallSP.OutParams(18)
        vntCompDate = objCallSP.OutParams(19)
        vntOffHold = objCallSP.OutParams(20)
        vntQtyShp = objCallSP.OutParams(21)
        vntShpDt = objCallSP.OutParams(22)
        vntCartons = objCallSP.OutParams(23)
        vntComments = objCallSP.OutParams(24)
        vntRowlock = objCallSP.OutParams(25)
        vntOnHoldDt = objCallSP.OutParams(26)
        vntOnHoldGblId = objCallSP.OutParams(27)
        vntOffHoldDt = objCallSP.OutParams(28)
        vntOffHoldGblId = objCallSP.OutParams(29)
        vntImportAuditInd = objCallSP.OutParams(30)

        If vntPart = "" OrElse vntPartKey = "" Then
            Err.Raise(281, , "Part number or part key ID not found for specified sequence ID")
        End If

        If vntOrigGblId <> "" Then
            blnRC = (New clsAssociate).RetrieveByGblId(vntOrigGblId, vntOrigName, vntOrigNetId, vntOrigEmail, vntOrigPhone, vntOrigMs, vntTemp, vntTemp, vntErrorNumber, vntErrorDesc)
        End If

        If vntOrigGblId = "" AndAlso vntOrigNetId <> "" Then
            blnRC = (New clsAssociate).RetrieveByNetId(vntOrigNetId, vntOrigName, vntOrigGblId, vntOrigEmail, vntOrigPhone, vntOrigMs, vntTemp, vntTemp, vntErrorNumber, vntErrorDesc)
        End If

        If vntStatus <> "" Then
            blnRC = (New clsStatus).Retrieve(vntStatus, vntTemp, vntStatDesc, vntErrorNumber, vntErrorDesc)
            If vntErrorNumber <> 0 Then
                Err.Raise(vntErrorNumber, , vntErrorDesc)
            End If
        End If

        If vntAudBldg <> "" Then
            blnRC = (New clsGlobalData).Retrieve(vntAudBldg, vntTemp, vntTemp, vntTemp, vntTemp, vntAudBldgDesc, vntTemp, vntTemp, vntErrorNumber, vntErrorDesc)
            If vntErrorNumber <> 0 Then
                Err.Raise(vntErrorNumber, , vntErrorDesc)
            End If
        End If

        If vntCompGblId <> "" Then
            blnRC = (New clsAssociate).RetrieveByGblId(vntCompGblId, vntCompName, vntCompNetId, vntCompEmail, vntCompPhone, vntCompMs, vntTemp, vntTemp, vntErrorNumber, vntErrorDesc)
        End If

        If vntOnHoldGblId <> "" Then
            blnRC = (New clsAssociate).RetrieveByGblId(vntOnHoldGblId, vntOnHoldName, vntOnHoldNetId, vntTemp, vntTemp, vntTemp, vntTemp, vntTemp, vntErrorNumber, vntErrorDesc)
        End If

        If vntOffHoldGblId <> "" Then
            blnRC = (New clsAssociate).RetrieveByGblId(vntOffHoldGblId, vntOffHoldName, vntOffHoldNetId, vntTemp, vntTemp, vntTemp, vntTemp, vntTemp, vntErrorNumber, vntErrorDesc)
        End If

        If vntAction <> "" Then
            blnRC = (New clsDisposition).RetrieveCategory(vntAction, vntActionDesc, vntErrorNumber, vntErrorDesc)
            If vntErrorNumber <> 0 Then
                Err.Raise(vntErrorNumber, , vntErrorDesc)
            End If
        End If

        If vntReqType <> "" Then
            blnRC = (New clsRequestType).Retrieve(vntReqType, vntReqTypeDesc, vntErrorNumber, vntErrorDesc)
            If vntErrorNumber <> 0 Then
                Err.Raise(vntErrorNumber, , vntErrorDesc)
            End If
        End If

        If vntPriority <> "" Then
            blnRC = (New clsPriority).Retrieve(vntPriority, vntPriorDesc, vntErrorNumber, vntErrorDesc)
            If vntErrorNumber <> 0 Then
                Err.Raise(vntErrorNumber, , vntErrorDesc)
            End If
        End If

        If vntActTk <> "" Then
            blnRC = (New clsAuditType).Retrieve(vntActTk, vntTemp, vntActTkDesc, vntErrorNumber, vntErrorDesc)
            If vntErrorNumber <> 0 Then
                Err.Raise(vntErrorNumber, , vntErrorDesc)
            End If
        End If

        Dim vntArray As Object(,) = (New clsAddFields).List(vntSeqId, vntErrorNumber, vntErrorDesc)
        If Not IsNothing(vntArray) Then
            vntSampPlan = ""
            vntPrcntPcs = ""
            vntDateCde = ""
            vntFO = ""
            vntPO = ""
            vntIblId = ""
            vntTlHold = ""
            For intCount = 0 To UBound(vntArray, 2)
                Select Case CInt(vntArray(0, intCount))
                    Case 1
                        If vntDateCde = "" Then
                            vntDateCde = Trim(vntArray(1, intCount).ToString())
                        Else
                            vntDateCde &= "," & Trim(vntArray(1, intCount).ToString())
                        End If
                    Case 2
                        If vntFO = "" Then
                            vntFO = Trim(vntArray(1, intCount).ToString())
                        Else
                            vntFO &= "," & Trim(vntArray(1, intCount).ToString())
                        End If
                    Case 3
                        If vntPO = "" Then
                            vntPO = Trim(vntArray(1, intCount).ToString())
                        Else
                            vntPO &= "," & vntArray(1, intCount).ToString()
                        End If
                    Case 5
                        If vntIblId = "" Then
                            vntIblId = Trim(vntArray(1, intCount).ToString())
                        Else
                            vntIblId &= "," & Trim(vntArray(1, intCount).ToString())
                        End If
                    Case 7
                        If vntTlHold = "" Then
                            vntTlHold = Trim(vntArray(1, intCount).ToString())
                        Else
                            vntTlHold &= "," & Trim(vntArray(1, intCount).ToString())
                        End If
                    Case 8
                        If vntSampPlan = "" Then
                            vntSampPlan = Trim(vntArray(1, intCount).ToString())
                        Else
                            vntSampPlan &= "," & Trim(vntArray(1, intCount).ToString())
                        End If
                    Case 9
                        If vntPrcntPcs = "" Then
                            vntPrcntPcs = Trim(vntArray(1, intCount).ToString())
                        Else
                            vntPrcntPcs &= "," & Trim(vntArray(1, intCount).ToString())
                        End If

                        'Case 10 'Audit Conversation Complete in WCS
                        '    Dim vntAuditConversationCompleteInWCS As String
                        '    vntAuditConversationCompleteInWCS = Trim(vntArray(1, intCount).ToString())
                End Select
            Next
            If vntSampPlan <> "" Then
                strSamplingPlan = vntSampPlan & "," & vntPrcntPcs
            End If
        Else
            vntDateCde = ""
            vntFO = ""
            vntPO = ""
            vntIblId = ""
            vntTlHold = ""
            vntSampPlan = ""
            'vntAuditConversationCompleteInWCS = ""
        End If

        vntErrorNumber = 0
        vntErrorDesc = ""

        Return True

ErrorHandler:

        vntErrorNumber = Err.Number
        vntErrorDesc = String.Format("{0} ({1})", Err.Description, Utility.QualifiedMethodName())

        Return False

    End Function

Сначала я подумал, что проблема в исходном коде, и мы думали, что исходный код, который мы имеем, отличается от того, который развернут на серверах test и prod. Но когда я попытался загрузить его на тестовый сервер, я не получил указанную неверную ошибку приведения.

Есть идеи, что проверить с настройкой или конфигами? зарегистрированные сборки может быть?

1 Ответ

1 голос
/ 01 сентября 2010

Это может быть связано с данными.Все ли среды используют один и тот же источник данных?

Кстати, у вас нет необходимой среды для отладки, чтобы найти проблему?

Редактировать после комментариев

Затем попробуйте отладить ее,техника отладки asp старого стиля.

Добавьте код, подобный Err.Raise (0, «Код работает без проблем»).Если вы получаете ошибку приведения, а не эту, то у вас есть проблема с кодами до нее :)

По крайней мере, это поможет вам найти код, вызывающий ошибку.

...