Munendra Kumar 0 Newbie Poster

Note : -- Actually the IP address of my system is 192.168.1.253. The sql server is on the system 192.168.1.12. On my system the program is working properly. When I publish tht web service in inetpub, I can access also on machine 192.168.1.144 by the URL "http://192.168.1.253/MyWebServices/Service.asmx". But the same default.aspx page on 192.168.1.144 can not access tht web service. It provides an error msg described above. will u plz help me............

The code in my web service is as follows:-----

Imports System.Web

Imports System.Web.Services

Imports System.Web.Services.Protocols

Imports System.Data.SqlClient

Imports System.Data

' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.

' <System.Web.Script.Services.ScriptService()> _

<WebService(Namespace:="http://tempuri.org/")> _ 
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _

Public Class ServiceInherits System.Web.Services.WebService 
<WebMethod()> _

Public Sub InsertData(ByVal cmd As String, ByVal con As String)

Dim dbConnection As New SqlConnection(con) 
dbConnection.Open()

Dim Command As New SqlCommand(cmd, dbConnection) 
Command.ExecuteNonQuery()

dbConnection.Close()

dbConnection = Nothing

End Sub

<WebMethod()> _

Public Function ReturnData(ByVal cmd As String, ByVal con As String) As DataSet 
Dim dbConnection As New SqlConnection(con)

Dim objCommand As New SqlDataAdapter(cmd, dbConnection)Dim ds As New DataSet 
objCommand.Fill(ds)

dbConnection.Close()

dbConnection = Nothing

Return ds 
End Function

End Class

The code in the default.aspx page is as follows : ---

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim trn As New Transfer.Service()
        Dim strData As String = "Select * from Test_Dup"
        Dim strCon As String = "server=192.168.1.12;uid=sa;pwddatabase=Master;"
        Dim ds As New DataSet
        ds = trn.ReturnData(strData, strCon)
        GridView1.DataSource = ds
        GridView1.DataBind()
    End Sub

The code in web.config is: --

<appSettings>
  <add key="Transfer.Service" value="http://192.168.1.253/MyWebServices/Service.asmx;"/>
</appSettings>

The error I got is :--

The request failed with HTTP status 405: Method not allowed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.