Web Service stops responding randomly

K

kairos

We have developed a web service that runs on W2k3 with IIS 5. It works fine
most of the time, but from time to time it stops responding. First we reset
the whole IIS and it started working again. Lately we discovered that
reinitiating the World Wide Web Publishing Service was enough to correct the
issue. But it's very annoying to restart this service each time the web
service stops responding.

We have already tried on a W2K server with same results.

We're using .NET Framework 2.0. Our client machines use Windos XP for Tablet
PC.

We have no meaningful entries on any windows logs. The WWW Publishing
Service has the Started status if we check it on the Services console. It
doesn´t stop the remaining IIS services, and even our public web page doesn´t
stop responding when the web service does.

Thx in advance.
 
S

Steven Cheng[MSFT]

Hello Juan,

From your description, I understand you have an ASP.NET webservice and host
on a windows 2003 server IIS5, it will periodly stop responding and require
you to restart the WWW service, correct?

As for this problem, I'd like to confirm the the following things first:

** windows 2003 by default has IIS6 has the component, do you mean you
configure IIS6 to run under IIS5 compatible mode?

** As for the ASP.NET webservice, would you provide some detailed code
logic about it, such as whether it is calling other components or do any
database or IO operations itself.

Based on my experience, there're several things that can make the
webservice(or other ASP.NET web applications) not responding.

** When ASP.NET application restart or the worker process get recycled, it
will unable to process new requests. This could happen when there occur
unhandled exception or the worker process has exceed the recycle
limitation. You can check the server's event log to see whether there is
any process recycle or exception information related to your ASP.NET
webservice application

** It is also possible that there occurs some lock issue which makes the
worker threads get blocked, thus, ASP.NET's free worker threads will get
exhausted and unable to respond further comming requests.

For general troubleshooting, you can check the following objects to detect
your application's wellness:

#server eventlog

#task manager(for CPU and memory usage)

#performance counter(asp.net specific) --- can inspect process and thread
statistics.

Hope this helps. Please feel free to post here if you have any other
findings.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================



This posting is provided "AS IS" with no warranties, and confers no rights.
 
K

kairos

Hi Steven,


I do appreciate your help with this problem. I’m sorry you’re right the w2k3
server is running IIS 6.0

The precise information is this:
IIS v 6.0
Windows Server 2003 R2 Standard Edition SP1
Dell Server PE 1800
Intel Xeon 2.8GHz 1Gb RAM

We have installed .NET Framework 2.0.50727 and also .NET Framework 1.1.4322

I'll check the logs and review the information you've posted meanwhile
following is a meaningful piece of our web service code:

Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Data.SqlClient

Imports System.Data.Odbc
Imports System.Data
Imports System.xml

<WebService(Namespace:="http://www.moc.com.mx/ws/SYC/ServicioAgencia",
Description:="Proporciona información de unidades automotrices que reciben
servicios de mantenimiento y/o reparación")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class ServicioAgencia
Inherits System.Web.Services.WebService

Dim strConexion As String =
System.Configuration.ConfigurationManager.ConnectionStrings("cnSYC").ConnectionString
Dim strConexionSYS As String =
System.Configuration.ConfigurationManager.ConnectionStrings("cnSYC_SYS").ConnectionString
Dim strConexionMOC As String =
System.Configuration.ConfigurationManager.ConnectionStrings("cnTabletMOC").ConnectionString

Private Const START_CUSTOM As String = "StartCustomException: "
Private Const END_CUSTOM As String = "EndCustomException"

'+++++++++++++++++++++++++++++++
'Funciones de consulta de la BD
'+++++++++++++++++++++++++++++++
Private Function ObtenerValor(ByVal strSQL As String, ByVal strCampo As
String) As String
Using scnTabla = New SqlConnection(strConexion)
scnTabla.open()
Dim scdSeleccionarTabla As New SqlCommand(strSQL, scnTabla)
Dim sdrTabla As SqlDataReader
sdrTabla = scdSeleccionarTabla.ExecuteReader()
If sdrTabla.Read() Then
Return IIf(IsDBNull(sdrTabla(strCampo)), "",
sdrTabla(strCampo))
Else
Return String.Empty
End If
End Using
End Function

Private Function LeerRegistro(ByVal strSQL As String, Optional ByVal
strCon As String = "") As SqlDataReader
If strCon = "" Then
strCon = strConexion
End If
Dim scnRegistro As New SqlConnection(strCon)
scnRegistro_Open()
Dim cmdSeleccionarRegistro As New SqlCommand(strSQL, scnRegistro)
Return cmdSeleccionarRegistro.ExecuteReader()
End Function

Private Function LeerTabla(ByVal strSQL As String) As DataSet
Using scnTabla As SqlConnection = New SqlConnection(strConexion),
scdSeleccionarTabla As SqlCommand = New SqlCommand(strSQL, cnTabla), sdaTabla
As SqlDataAdapter = New SqlDataAdapter(scdSeleccionarTabla), dstTabla As
DataSet = New DataSet
sdaTabla.Fill(dstTabla)
Return dstTabla
End Using
End Function


<WebMethod(Description:="Guarda la orden de servicio en la base de datos
de la agencia.")> _
Public Function GuardarOrdenServicioCompleta(ByVal objOrdenServicio As
OServicioCompleta, ByVal arrRegistrosProblemas() As String) As String
'ResultadoGrabarOrdenServicio
Dim strShipToId As String
strShipToId = ""
Dim scnCliente As SqlConnection
Dim cmdSelect

''''''''''''''''''''''''''''''''''
Dim strCustName_obtenido As String
strCustName_obtenido = ObtenerValor("Select Top 1 RazonSocial From
xSoAddress Where CustID = '" &
Trim(objOrdenServicio.PropObjCliente.strCustID) & "' And ShipToID = 'DEFAULT'
", "RazonSocial")
''''''''''''''''''''''''''''''''''

scnCliente = New SqlConnection(strConexion)
scnCliente.Open()

Dim strNote As String
With objOrdenServicio
strNote = "'" & Trim(.PropOrdenServicio.strNoteText) & "'"
End With


Dim strServicio As String
With objOrdenServicio
strServicio = "'" & Trim(.PropObjCliente.strCustID) & "',"
strServicio = strServicio & "'" &
Trim(.PropOrdenServicio.strAssignEmpID) & "',"
strServicio = strServicio & "'" &
Trim(.PropOrdenServicio.strCallerName) & "',"
strServicio = strServicio & "'" &
Trim(.PropOrdenServicio.strCallStatus) & "',"
strServicio = strServicio & "'" &
Trim(.PropOrdenServicio.strCallType) & "',"
strServicio = strServicio & "'" &
Trim(.PropOrdenServicio.strCrtd_DateTime) & "',"
strServicio = strServicio & "'" &
Trim(.PropOrdenServicio.strCrtd_User) & "',"
''Valor que se obtiene, ya que es el xSOAddress.RazonSocial --NO
es ya Trim(.PropOrdenServicio.strCustName)
strServicio = strServicio & "'" & Trim(Mid(strCustName_obtenido,
1, 30)) & "',"
strServicio = strServicio & "'" &
Trim(.PropObjCliente.strCustID) & "',"
strServicio = strServicio & "'" &
Trim(.PropOrdenServicio.strCustPhone) & "',"
strServicio = strServicio & "'" &
Trim(.PropOrdenServicio.strLupd_DateTime) & "',"
strServicio = strServicio & "'" &
Trim(.PropOrdenServicio.strLupd_User) & "',"
'strServicio = strServicio & "'" &
IIf(Trim(.PropOrdenServicio.strNoteId) = "", " ",
Trim(.PropOrdenServicio.strNoteId)) & "',"
strServicio = strServicio & "'" &
Trim(.PropOrdenServicio.strPerEnt) & "',"
strServicio = strServicio & "'" &
Trim(.PropOrdenServicio.strServiceCallDate) & "',"
strServicio = strServicio & "'" &
Trim(.PropOrdenServicio.strServiceCallDateProm) & "',"
strServicio = strServicio & "'" &
Trim(.PropOrdenServicio.strServiceCallPriority) & "',"
strServicio = strServicio & "'" &
Trim(.PropOrdenServicio.strShipToId) & "',"
strServicio = strServicio & "'" &
Trim(.PropOrdenServicio.strSIsperID) & "',"
strServicio = strServicio & "'" &
Trim(.PropOrdenServicio.strUser2) & "',"
strServicio = strServicio & "'" &
Trim(.PropOrdenServicio.strUserID) & "'"
End With

Dim strIdProblemas As String
Dim strProblemas As String

strIdProblemas = ""
strProblemas = ""


'Si el arreglo de los problemas tiene un renglon pero está en blanco
(Valor igual a 0),
'no hay que almacenarlo
If arrRegistrosProblemas.Length >= 1 And arrRegistrosProblemas(0) <>
0 Then
With objOrdenServicio

strProblemas = "'" &
Trim(.PropOrdenServicio.strCrtd_DateTime) & "',"
strProblemas = strProblemas & "'" &
Trim(.PropOrdenServicio.strCrtd_Prog) & "',"
strProblemas = strProblemas & "'" &
Trim(.PropOrdenServicio.strCrtd_User) & "',"
'EndDate
strProblemas = strProblemas & "'" &
Trim(.PropOrdenServicio.strLupd_DateTime) & "',"
strProblemas = strProblemas & "'" &
Trim(.PropOrdenServicio.strLupd_DateTime) & "',"
strProblemas = strProblemas & "'" &
Trim(.PropOrdenServicio.strLupd_Prog) & "',"
strProblemas = strProblemas & "'" &
Trim(.PropOrdenServicio.strLupd_User) & "',"
'SF_ID03
strProblemas = strProblemas & "'" &
Trim(.PropOrdenServicio.strCrtd_DateTime) & "',"
'StartDate
strProblemas = strProblemas & "'" &
Trim(.PropOrdenServicio.strCrtd_DateTime) & "'"

'Guardar Problema 0
strIdProblemas = arrRegistrosProblemas(0) & ","
'Guardar Problemas del 1 en Adelante
For i As Integer = 1 To arrRegistrosProblemas.Length - 1
strIdProblemas = strIdProblemas &
arrRegistrosProblemas(i) & ","
Next

''Quitaba la coma final de strIdProblemas
'strIdProblemas = Mid(strIdProblemas, 1, Len(strIdProblemas)
- 1)
End With
End If

Dim strAutomovil As String

With objOrdenServicio
strAutomovil = "'" & Trim(.PropObjAutomovil.strColor) & "',"
strAutomovil = strAutomovil & Trim(.PropObjAutomovil.strKms) & ","
strAutomovil = strAutomovil & "'" &
Trim(.PropObjAutomovil.strMarca) & "',"
strAutomovil = strAutomovil & "'" &
Trim(.PropObjAutomovil.strModelo) & "',"
strAutomovil = strAutomovil & "'" &
Trim(.PropObjAutomovil.strPlacas) & "',"
strAutomovil = strAutomovil & "'" &
Trim(.PropObjAutomovil.strSerie) & "',"
strAutomovil = strAutomovil & "'" &
Trim(.PropObjAutomovil.strYear) & "',"
strAutomovil = strAutomovil & "'" &
Trim(.PropObjAutomovil.strTipo) & "',"
strAutomovil = strAutomovil & "'" &
Trim(.PropObjAutomovil.strTorre) & "'"
End With

cmdSelect = New SqlCommand("GuardarOrdenServicioCompleta", scnCliente)
cmdSelect.CommandType = CommandType.StoredProcedure

'''''''''''''''''''''''''''''''''
Dim p0 As SqlParameter = New SqlParameter("@strNote",
SqlDbType.VarChar)
p0.Value = strNote
p0.Direction = ParameterDirection.Input
cmdSelect.Parameters.Add(p0)

Dim p As SqlParameter = New SqlParameter("@strServicio",
SqlDbType.VarChar)
p.Value = strServicio
p.Direction = ParameterDirection.Input
cmdSelect.Parameters.Add(p)

Dim p1 As SqlParameter = New SqlParameter("@strProblemas",
SqlDbType.VarChar)
p1.Value = strProblemas
p1.Direction = ParameterDirection.Input
cmdSelect.Parameters.Add(p1)

Dim p2 As SqlParameter = New SqlParameter("@strIdProblemas",
SqlDbType.VarChar)
p2.Value = strIdProblemas
p2.Direction = ParameterDirection.Input
cmdSelect.Parameters.Add(p2)

Dim p3 As SqlParameter = New SqlParameter("@strAutomovil",
SqlDbType.VarChar)
p3.Value = strAutomovil
p3.Direction = ParameterDirection.Input
cmdSelect.Parameters.Add(p3)

Dim p4 As SqlParameter = New SqlParameter("@Resultado",
SqlDbType.VarChar)
p4.Size = 10
p4.Direction = ParameterDirection.Output
cmdSelect.Parameters.Add(p4)

cmdSelect.ExecuteNonQuery()

scnCliente.Close()

If cmdSelect.Parameters("@Resultado").Value <> "0" Then
Return cmdSelect.Parameters("@Resultado").Value
'ResultadoGrabarOrdenServicio.Satisfactorio
Else
Return "0"
'ResultadoGrabarOrdenServicio.FallaInsertarOrdenServicio
End If

End Function

--
Juan Gonzalez
Avansys
Mexico
 
S

Steven Cheng[MSFT]

Thanks for your reply Juan,

From the code you provided, the webservice is mostly focus on data access
and all the code are performing data accessing through ADO.NET. Therefore,
in addition to the items I mentioned in the last reply, you can also check
the SQL Server side to see whether there is anything abnormal (such as
memory usage and deadlock ....).

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top