dimanche 22 février 2015

vb.net service not responding ,

Dears I have built this service in Microsoft visual studio 2008 and there is no errors show in the code , and when i deploy the service in the IIS manager it does not work ?? Please guide me what to do me...??





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



Namespace WebService1

'To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebService(Namespace:="http://ift.tt/1B8JO4U")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
Public Class Service1
Inherits System.Web.Services.WebService

<WebMethod()> _
Public Function HelloWorld() As String
Return "Hello World"
End Function



<WebMethod()> _
Public Function GetDataTable(ByVal ConnectionString As String, ByVal SqlSt As String) As DataTable
Dim result As DataTable

Dim res As Integer
res = 0

Dim mn As Integer
mn = 1
'returninfi(Context.Request.UserHostAddress)

If mn = 1 Then
Try
Dim conn As SqlConnection = New SqlConnection(ConnectionString)
Dim ds As DataSet = New DataSet()
Dim a As New SqlDataAdapter() With {.SelectCommand = New SqlCommand(SqlSt, conn)}
a.Fill(ds, "Account")
result = ds.Tables("Account")
Return result
Catch ex_44 As Exception
End Try
End If

Return result
End Function

<WebMethod()> _
Public Function RunSQL(ByVal ConnectionString As String, ByVal queryString As String) As String

Dim a As Integer
a = 1
' returninfi(Context.Request.UserHostAddress)
Dim result As String
result = ""

If a = 1 Then

Try
Using connection As SqlConnection = New SqlConnection(ConnectionString)
Dim command As SqlCommand = New SqlCommand(queryString, connection)
connection.Open()
command.ExecuteNonQuery()
connection.Close()
result = "1"
End Using
Catch ex As Exception
result = ex.Message.ToString()
End Try
End If


Return result
End Function


Public Function returninfi(ByVal ip As String) As Integer
Dim result As DataTable
Dim res As Integer
Try
Dim ConnectionString = "Data Source=WIN-DFSIR3RC74G\SQLEXPRESS;Initial Catalog=SMS;User

ID=sa;Password=22334"
Dim conn As SqlConnection = New SqlConnection(ConnectionString)
Dim ds As DataSet = New DataSet()
Dim Sqlstr As String
Sqlstr = "select * from sec_users where ipadress ='" & ip & "'"


Dim a As New SqlDataAdapter() With {.SelectCommand = New SqlCommand(Sqlstr, conn)}
a.Fill(ds)


'if (ds.Tables.Count > 0) and ds.Tables[0].Rows.Count > 0) then
' If (ds.Tables.Count > 0) And True Then
If (ds.Tables.Count > 0) And (ds.Tables(0).Rows.Count > 0) Then

res = 1
Else
res = 0
End If

'result = ds.Tables("Account")

Return res

Catch ex_44 As Exception
End Try
res = 0
Return res
End Function







End Class

End Namespace



Aucun commentaire:

Enregistrer un commentaire