HTTP 500 iNTERNAL SERVER ERROR
- From: "Ross" <Ross@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 24 May 2005 02:36:03 -0700
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
.
- Prev by Date: Getting up to speed with WebServices
- Next by Date: Re: Getting up to speed with WebServices
- Previous by thread: Getting up to speed with WebServices
- Next by thread: managed c++ webservice problem
- Index(es):
Relevant Pages
|
Loading