HTTP 500 iNTERNAL SERVER ERROR

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ross

    HTTP 500 iNTERNAL SERVER ERROR

    Hi folks

    I have been designing a web service that is intended to extract information
    from a SQL server DB using parameterised SP's. So far I have 2 web methods.

    1 GetPostCodeForS uburb(ByVal intSuburb As Int64) As postcode1
    2 GetSuburbIDAndN ameForSuburbSta rt(ByVal vchSuburb_Start As Char) As
    dsSuburbIDAndNa me

    The 1st web method GetPostCodeForS uburb is working OK, but the 2nd one
    GetSuburbIDAndN ameForSuburbSta rt has a bug.

    ''''''''''''''' ''''''''''''''' ''''
    When I press F5 a web page comes up with two hyperlinks for the two web
    methods. When I choose the 2nd one, a web page pops up quoting "HTTP 500
    Internal Server Error". In the body of the page the following message
    appears "The page cannot be displayed".

    Clicking on the localhost link brings up the following page:
    http://localhost/localstart.asp that has the following message in the body:

    ''''''''''''''' ''''''''''''''
    Your Web service is now running.
    You do not currently have a default Web page established for your users. Any
    users attempting to connect to your Web site from another machine are
    currently receiving an Under Construction page. Your Web server lists the
    following files as possible default Web pages:
    default.htm,def ault.asp,index. htm,iisstart.as p,default.aspx. Currently, only
    iisstart.asp exists.

    To add documents to your default Web site, save files in c:\inetpub\wwwr oot\.

    The code for the Web method is as follows:

    ''''''''''''''' ''''''''''''''' '''''

    <WebMethod()> Public Function GetSuburbIDAndN ameForSuburbSta rt(ByVal
    vchSuburb_Start As Char) As dsSuburbIDAndNa me

    Dim dsSuburb As New dsSuburbIDAndNa me
    Dim cn As SqlConnection
    Dim strConnInfo As String
    Dim cmd As SqlCommand
    Dim pmTemp As SqlParameter
    Dim adSuburb As SqlDataAdapter

    adSuburb = New SqlDataAdapter

    strConnInfo = "server=USE R-LMZWW8DZJO;Inte grated
    Security=SSPI;u id=dbo;pwd=;dat abase=Australia nPostCodes"
    Try
    cn = New SqlConnection
    cn.ConnectionSt ring = strConnInfo
    cn.Open()

    Try
    cmd = New SqlCommand
    cmd.CommandType = CommandType.Sto redProcedure
    cmd.CommandText = "procGetSuburbI DAndNameForSubu rbStart"
    cmd.Connection = cn

    pmTemp = cmd.Parameters. Add(New
    SqlParameter("@ suburb_start", SqlDbType.VarCh ar))
    pmTemp.Directio n = ParameterDirect ion.Input
    pmTemp.Value = vchSuburb_Start

    adSuburb.Select Command = cmd
    adSuburb.Fill(d sSuburb)
    Return dsSuburb

    Catch ex As Exception

    End Try

    Catch exc As SqlException
    Dim errorMessages As String
    Dim i As Integer

    For i = 0 To exc.Errors.Coun t - 1
    errorMessages += "Index #" & i.ToString() &
    ControlChars.Ne wLine _
    & "Message: " & exc.Errors(i).M essage &
    ControlChars.Ne wLine _
    & "LineNumber : " & exc.Errors(i).L ineNumber &
    ControlChars.Ne wLine _
    & "Source: " & exc.Errors(i).S ource &
    ControlChars.Ne wLine _
    & "Procedure: " & exc.Errors(i).P rocedure &
    ControlChars.Ne wLine
    Next i

    Dim log As System.Diagnost ics.EventLog = New
    System.Diagnost ics.EventLog
    log.Source = "My Application"
    log.WriteEntry( errorMessages)
    Console.WriteLi ne("An exception occurred. Please contact your
    system administrator." )

    Finally

    If cn.State = ConnectionState .Open Then
    cn.Close()
    End If

    End Try

    End Function

    ''''''''''''''' ''''''''''''''' '''

    Quite frankly, I cannot understand this - hope somebody can help

    Kind regards

    Ross Petersen
Working...