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 GetPostCodeForSuburb(ByVal intSuburb As Int64) As postcode1
2 GetSuburbIDAndNameForSuburbStart(ByVal vchSuburb_Start As Char) As
dsSuburbIDAndName

The 1st web method GetPostCodeForSuburb is working OK, but the 2nd one
GetSuburbIDAndNameForSuburbStart 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,default.asp,index.htm,iisstart.asp,default.aspx. Currently, only
iisstart.asp exists.

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

The code for the Web method is as follows:

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

<WebMethod()> Public Function GetSuburbIDAndNameForSuburbStart(ByVal
vchSuburb_Start As Char) As dsSuburbIDAndName

Dim dsSuburb As New dsSuburbIDAndName
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=USER-LMZWW8DZJO;Integrated
Security=SSPI;uid=dbo;pwd=;database=AustralianPostCodes"
Try
cn = New SqlConnection
cn.ConnectionString = strConnInfo
cn.Open()

Try
cmd = New SqlCommand
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "procGetSuburbIDAndNameForSuburbStart"
cmd.Connection = cn

pmTemp = cmd.Parameters.Add(New
SqlParameter("@suburb_start", SqlDbType.VarChar))
pmTemp.Direction = ParameterDirection.Input
pmTemp.Value = vchSuburb_Start

adSuburb.SelectCommand = cmd
adSuburb.Fill(dsSuburb)
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.Count - 1
errorMessages += "Index #" & i.ToString() &
ControlChars.NewLine _
& "Message: " & exc.Errors(i).Message &
ControlChars.NewLine _
& "LineNumber: " & exc.Errors(i).LineNumber &
ControlChars.NewLine _
& "Source: " & exc.Errors(i).Source &
ControlChars.NewLine _
& "Procedure: " & exc.Errors(i).Procedure &
ControlChars.NewLine
Next i

Dim log As System.Diagnostics.EventLog = New
System.Diagnostics.EventLog
log.Source = "My Application"
log.WriteEntry(errorMessages)
Console.WriteLine("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
.



Relevant Pages

  • Re: Posting a dataset to a database
    ... ..NET web service on the server, creating a web method to process the ... the pocket pc to the web service. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Posting a dataset to a database
    ... .NET web service on the server, creating a web method to process the ... the pocket pc to the web service. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Single instance???
    ... There is a web service which has a web method call OpenPublicConnection which will open a connection to the SQL Server, and there is a web method call StartTransaction to start a tranaction for the class level connection which is opened by the OpenPublicConection Method. ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: CacheDuration question
    ... Web Service cache is hold in server side. ... >I have a question about the CacheDuration property of a web method. ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • web service - has timed out.
    ... i'm using w server 2003 and W Mobile 5.0. ... my web service: ... Public Function ...... ...
    (microsoft.public.dotnet.framework.compactframework)

Loading