Web Service not function on server with CascadingDropDown

Last post 08-05-2008 1:05 AM by Mustang65. 1 replies.

Sort Posts:

  • Web Service not function on server with CascadingDropDown

    07-31-2008, 5:25 PM
    • Member
      38 point Member
    • Mustang65
    • Member since 01-10-2006, 1:21 PM
    • California
    • Posts 18

    Hello all,

    Here is my porblem.  I have created a webservice to pull information from a database and return the results to a CascadingDropDown.  This all works great on my local machine.  The problem is when I post the site to a webserver the results never get returned.  Below is the code for the web service and the CascadingDropDown.  I am sure it is something very simple that I am missing and any help is greatly appreciated.

    Web Service Code.

    Imports System.Web.Services.Protocols
    Imports AjaxControlToolkit
    Imports System.Data
    Imports System.Data.SqlClient
    Imports System.Collections.Generic
    Imports System.Web.Configuration
    
    <System.Web.Script.Services.ScriptService()> _
    <WebService(Namespace:="http://tempuri.org/")> _
    <WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
    <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
    Public Class OpCoList
        Inherits System.Web.Services.WebService
    
        <WebMethod()> _
        Public Function OpCoList(ByVal knownCategoryValues As String, ByVal category As String) As CascadingDropDownNameValue()
            Dim objConn As New SqlConnection(WebConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)
            Dim objReader As SqlDataReader
            Dim objcommand As New SqlCommand("Select * From OpCO", objConn)
            Dim ListOfOPCOS As New List(Of CascadingDropDownNameValue)()
            MsgBox("TESTING")
            Try
                objConn.Open()
                objReader = objcommand.ExecuteReader
    
                If objReader.HasRows Then
                    'System.Threading.Thread.Sleep(3000)
                    While objReader.Read()
                        ListOfOPCOS.Add(New CascadingDropDownNameValue(objReader.Item("CompanyName").ToString, objReader.Item("UniqueKey").ToString))
                    End While
                End If
            Catch ex As Exception
                ListOfOPCOS.Add(New CascadingDropDownNameValue(ex.Message, ex.InnerException.ToString))
                MsgBox(ex.Message)
            Finally
                objConn.Close()
            End Try
            Return ListOfOPCOS.ToArray
    
        End Function
    
    End Class

     CascadingDropDown.

    <ajaxToolkit:CascadingDropDown ID="cdd_OpCo" runat="server" Category="OpCo" LoadingText="Loading OpCo's ..."
                    PromptText="Select an OpCo" PromptValue="Select an OpCo" ServiceMethod="OpCoList"
                    ServicePath="OpCoList.asmx" TargetControlID="ddl_OpCo">
     
    Thanks,
    Mike L.
  • Re: Web Service not function on server with CascadingDropDown

    08-05-2008, 1:05 AM
    Answer
    • Member
      38 point Member
    • Mustang65
    • Member since 01-10-2006, 1:21 PM
    • California
    • Posts 18

    All, 

    I have found the solution to my own problem.  The reason the above only works on my local machine and not the server is do to me using an SQLExpress database.  This works perfectly fine on the local machine.  This does not work at all on the server.  The reason for this is the deafult setting of SQLExpress to not allow remote connections.  Once I installed the SQLExpress software on the server and configured it to allow remote connections everything worked properly.  I am not sure why there is a difference between running the solution on the localhost or the webserver.  If anyone can explain it that would be great.

    Thanks,
    Mike L.
Page 1 of 1 (2 items)