locked
Web Service Not Working with Host RRS feed

  • Question

  • User1225369314 posted

    Hi, I've created some Cascading drop Down boxes, they work great on my PC ussing IIS.

    But when I upload the files to our host (1and1) the drop down boxes display 'method error 500'

    I havent changed anything, I have just copied all of the files to the website.

    Is there anything I could have missed or any way to narrow down the error?

    Below is the code I use.

    Many Thanks

    Helper.asmx

    <%@ WebService Language="VB" CodeBehind="~/App_Code/Helper.vb" Class="Helper" %>

    SourceOfWorkPage.aspx

    ..........
                    <td width="35%">
      
                        <asp:DropDownList ID="ddlLevel1" style="width: 95%;" runat="server" onmousedown="onSelectMouseDown()" />
                        <ajaxToolkit:CascadingDropDown ID="cddLevel1" runat="server" TargetControlID="ddlLevel1" LoadingText="Loading..."
                            Category="Level1" ServicePath="Helper.asmx" ServiceMethod="GetLevel1" BehaviorID="cdd1" UseContextKey="true" ContextKey="Client" />
                    
                        
                    </td>
    
                </tr>
    
    
                <tr style="height:40px;" >
                
                    <td width="35%">
    
                        <asp:DropDownList ID="ddlLevel2" style="width: 95%;" runat="server" />
                        <ajaxToolkit:CascadingDropDown ID="ccdLevel2" BehaviorID="cdd2" runat="server" TargetControlID="ddlLevel2" 
                            ParentControlID="ddlLevel1" Category="Level2" 
                            ServicePath="Helper.asmx" ServiceMethod="GetLevel2" />
                    
                    </td>
    
                </tr>
    
    ..........

    Helper.vb (in App_Code)

    <WebService([Namespace]:="http://tempuri.org/")> _
    <WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
    <System.Web.Script.Services.ScriptService()> _
    Public Class Helper
        Inherits System.Web.Services.WebService
    
    
        <WebMethod()> _
        Public Function GetLevel1(knownCategoryValues As String, category As String) As CascadingDropDownNameValue()
    
            Dim Sql As Object
    
            Dim myConnectionString As String = "server=db475822258.db.1and1.com; initial catalog=db475822258;uid=dbo4758222518;pwd=mypassword"
    
            Dim myConnection As New SqlConnection(myConnectionString)
    
            myConnection.Open()
    
            Sql = " SELECT Level1Name, Level1ID FROM Level1 "
            Sql += " ORDER BY Level1Name "
    
            Dim dbcomm As New SqlDataAdapter(Sql, MyConnection)
            Dim values As New List(Of CascadingDropDownNameValue)()
    
            Dim dt As New DataTable()
            dbcomm.Fill(dt)
    
            If dt.Rows.Count > 0 Then
                values.Add(New CascadingDropDownNameValue("--Select--", 0))
    
                For Each dr As DataRow In dt.Rows
                    values.Add(New CascadingDropDownNameValue(dr("Level1Name"), dr("Level1ID")))
                Next
            End If
    
    
            Return values.ToArray()
    
        End Function
    
    
        <WebMethod()> _
        Public Function GetLevel2(knownCategoryValues As String, category As String) As CascadingDropDownNameValue()
    
            Dim knownCategoryValuesDictionary As StringDictionary = AjaxControlToolkit.CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues)
            Dim val As String = knownCategoryValuesDictionary("Level1")
    
            Dim Sql As Object
    
            Dim myConnectionString As String = "server=db475822258.db.1and1.com; initial catalog=db475822258;uid=dbo4758222518;pwd=mypassword"
    
            Dim myConnection As New SqlConnection(myConnectionString)
    
            myConnection.Open()
    
            Sql = " SELECT * FROM Level2 WHERE Level1ID = " & val
            Sql += " ORDER BY Level2Name "
    
            Dim dbcomm As New SqlDataAdapter(Sql, MyConnection)
            Dim values As New List(Of CascadingDropDownNameValue)()
    
            Dim dt As New DataTable()
            dbcomm.Fill(dt)
    
            If dt.Rows.Count > 0 Then
                values.Add(New CascadingDropDownNameValue("--Select--", 0))
    
                For Each dr As DataRow In dt.Rows
                    values.Add(New CascadingDropDownNameValue(dr("Level2Name"), dr("Level2ID")))
                Next
            End If
    
            Return values.ToArray()
    
        End Function
    




    Saturday, June 22, 2013 6:06 AM

All replies

  • User-1315512054 posted

    Hello,

    It seems that the AJAX Control Toolkit is not installed on the server. Read a solution at how to use AJAX Control Toolkit on sharad ASP.NET hosting.

    Regards

    Saturday, June 22, 2013 8:14 AM
  • User1225369314 posted

    Thanks for your reply.

    I have put the ajax control toolkit files in the bin folder.

    The page which is not working is here - http://futureharrogate.co.uk/default.aspx

    How can I use fiddler to display more details on the error?

    I downloaded the example from here - http://www.mikeborozdin.com/file.axd?file=CascadingDropDown.zip

    And just uploaded the files to the hosted directory. 

    The pages work no problem when previewing the page locally through visual studio.

    Many thanks

    Sunday, June 23, 2013 4:43 AM
  • User1225369314 posted

    I think I may have figured out how to use fiddler.

    I ran fiddler and opened my page. I went to the 500 error in the list and double clicked on the first 500 error in the list

    Below is what it displayed, thanks for any advice

    This is what is displayed when I load my local page:

    {"d":[{"__type":"AjaxControlToolkit.CascadingDropDownNameValue","name":"North America","value":"North America","isDefaultValue":false},{"__type":"AjaxControlToolkit.CascadingDropDownNameValue","name":"Europe","value":"Europe","isDefaultValue":false}]}


    This is what is displayed when i load the hosted page:

    <!DOCTYPE html>

    <html>
    <head>
    <title>Unknown web method GetContinents.<br>Parameter name: methodName</title>
    <meta name="viewport" content="width=device-width" />
    <style>
    body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}
    p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
    b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
    H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
    H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
    pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}
    .marker {font-weight: bold; color: black;text-decoration: none;}
    .version {color: gray;}
    .error {margin-bottom: 10px;}
    .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
    @media screen and (max-width: 639px) {
    pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }
    }
    @media screen and (max-width: 479px) {
    pre { width: 280px; }
    }
    </style>
    </head>

    <body bgcolor="white">

    <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>

    <h2> <i>Unknown web method GetContinents.<br>Parameter name: methodName</i> </h2></span>

    <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

    <b> Description: </b>An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    <br><br>

    <b> Exception Details: </b>System.ArgumentException: Unknown web method GetContinents.<br>Parameter name: methodName<br><br>

    <b>Source Error:</b> <br><br>

    <table width=100% bgcolor="#ffffcc">
    <tr>
    <td>
    <code>

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.</code>

    </td>
    </tr>
    </table>

    <br>

    <b>Stack Trace:</b> <br><br>

    <table width=100% bgcolor="#ffffcc">
    <tr>
    <td>
    <code><pre>

    [ArgumentException: Unknown web method GetContinents.
    Parameter name: methodName]
    System.Web.Script.Services.WebServiceData.GetMethodData(String methodName) +178
    System.Web.Script.Services.RestHandler.CreateHandler(WebServiceData webServiceData, String methodName) +11
    System.Web.Script.Services.RestHandler.CreateHandler(HttpContext context) +155
    System.Web.Script.Services.RestHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated) +60
    System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated) +48
    System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +346
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +155
    </pre></code>

    </td>
    </tr>
    </table>

    <br>

    <hr width=100% size=1 color=silver>

    <b>Version Information:</b>&nbsp;Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18034

    </font>

    </body>
    </html>
    <!--
    [ArgumentException]: Unknown web method GetContinents.
    Parameter name: methodName
    at System.Web.Script.Services.WebServiceData.GetMethodData(String methodName)
    at System.Web.Script.Services.RestHandler.CreateHandler(WebServiceData webServiceData, String methodName)
    at System.Web.Script.Services.RestHandler.CreateHandler(HttpContext context)
    at System.Web.Script.Services.RestHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated)
    at System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated)
    at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    --><!--
    This error page might contain sensitive information because ASP.NET is configured to show verbose error messages using &lt;customErrors mode="Off"/&gt;. Consider using &lt;customErrors mode="On"/&gt; or &lt;customErrors mode="RemoteOnly"/&gt; in production environments.-->

    Sunday, June 23, 2013 4:52 AM