开发者

Debugging ASP.Net web.config issue on shared host

I'm running my app on shared hosting.

When I run the latest changes on my dev server, everything works fine - When I upload, I see the generic "Error occured but isn't being shown" message.

If I change my web.config to include

CustomErrors mode="off"

then I still see the same error message.

I'm guessing that one of my recent changes is causing an issues when web.config is being parsed.

Is there any way I can retrieve the details of this error? The only ways I'm aware of are Event log and server logs - neither of which I have access to.

Many thanks in advance for any help


Here's the code to save everyone else some time in future. Will format the exception details and mail it. Add a Global.asax if it doesn't exist. then update the Application_Error method.

    Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
    ' Code that runs when an unhandled error occurs
    Dim ex As Exception = Server.GetLastError().GetBaseException()
    Dim ErrMsg As New Text.StringBuilder

    While ex IsNot Nothing
        ErrMsg.AppendLine(String.Format("Message : {0}", ex.Message))
        ErrMsg.AppendLine(String.Format("Source : {0}", ex.Source))
        ErrMsg.AppendLine(String.Format("Target : {0}", ex.TargetSite.ToString))
        ErrMsg.AppendLine("Stack: ")
        ErrMsg.AppendLine(ex.StackTrac开发者_StackOverflowe)

        If ex.InnerException IsNot Nothing Then
            ex = ex.InnerException
            ErrMsg.AppendLine(">> Inner Exception >>>>>>>>>>>>>>>>>>>>>")
        Else
            ex = Nothing
        End If

    End While

    Try
        Dim Message As New System.Net.Mail.MailMessage
        Message.Body = ErrMsg.ToString

        Message.Subject = "MPW Error"
        Message.To.Add(New MailAddress("EMAIL_ADDRESS_HERE@example.com"))
        Dim SMTP As New SmtpClient
        SMTP.Send(Message)

    Catch FatalEx As Exception
        'Write to file, die or re-throw
    End Try
End Sub


this is the way.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜