This is a migrated thread and some comments may be shown as answers.

the server method '' failed

8 Answers 353 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Ekjot
Top achievements
Rank 1
Ekjot asked on 09 Apr 2012, 02:59 AM
Hello

I am using a web service like the demo to populate the items in the RadComboBox on demand. This is all working find when i am running the program through VS2010 but is failing when I try through IIS.

Also it works for Http and does not work for Https so I think the solution lies there somewhere. 

Here is my .aspx:

<telerik:RadComboBox AutoPostBack="true" ID="txtGelPackProdCode" runat="server" EnableLoadOnDemand="true" ShowMoreResultsBox="true" EnableVirtualScrolling="true" EmptyMessage="Enter here..." onselectedindexchanged="txtGelPackProdCode_SelectedIndexChanged">
<WebServiceSettings Path="MasterFormulaWebService.svc" Method="LoadProductData" />
</telerik:RadComboBox>

this is the svc method:

public RadComboBoxData LoadProductData(RadComboBoxContext context)
       {
           string text = context.Text.Trim() + '%';
 
           DataTable data = ProductDAO.ViewData2(text, "RadCombo");
 
           List<RadComboBoxItemData> result = new List<RadComboBoxItemData>(context.NumberOfItems);
           RadComboBoxData comboData = new RadComboBoxData();
 
           try
           {
               int itemsPerRequest = 10;
               int itemOffset = context.NumberOfItems;
               int endOffset = itemOffset + itemsPerRequest;
               if (endOffset > data.Rows.Count)
               {
                   endOffset = data.Rows.Count;
               }
               if (endOffset == data.Rows.Count)
               {
                   comboData.EndOfItems = true;
               }
               else
               {
                   comboData.EndOfItems = false;
               }
               result = new List<RadComboBoxItemData>(endOffset - itemOffset);
               for (int i = itemOffset; i < endOffset; i++)
               {
                   RadComboBoxItemData itemData = new RadComboBoxItemData();
                   itemData.Text = data.Rows[i]["prod_code"].ToString().Trim();
                   itemData.Value = data.Rows[i]["name"].ToString().Trim();
                   result.Add(itemData);
               }
               if (data.Rows.Count > 0)
               {
                   comboData.Message = String.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset.ToString(), data.Rows.Count.ToString());
               }
               else
               {
                   comboData.Message = "No matches";
               }
           }
           catch (Exception e)
           {
               comboData.Message = e.Message;
           }
           comboData.Items = result.ToArray();
           return comboData;
       }


and this is the webconfig:

<system.serviceModel>
    <behaviors>
      <endpointBehaviors>
        <behavior name="Reena.Master.MasterFormulaWebServiceAspNetAjaxBehavior">
          <enableWebScript />
        </behavior>
      </endpointBehaviors>
    </behaviors>
      <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
        multipleSiteBindingsEnabled="true"
          
 
      />
       
    <services>
      <service name="Reena.Master.MasterFormulaWebService">
        <endpoint address="" behaviorConfiguration="Reena.Master.MasterFormulaWebServiceAspNetAjaxBehavior"
          binding="webHttpBinding" contract="Reena.Master.MasterFormulaWebService" />
      </service>
    </services>
      <bindings>
          <webHttpBinding>
              <binding name="webBinding">
                  <security mode="None">
                  </security>
              </binding>
          </webHttpBinding>
      </bindings>
  </system.serviceModel>


What am I doing wrong? Thanks

8 Answers, 1 is accepted

Sort by
0
Dimitar Terziev
Telerik team
answered on 11 Apr 2012, 12:37 PM
Hi,

Probably the problem is caused by an authentication issue In general the web service consumed by the RadComboBox should allow anonymous access. Please try to add the following lines to your web config file:
<location path="Reena.Master.MasterFormulaWebService.svc">  
    <system.web>      
        <authorization>
            <allow users="*" />      
        </authorization>  
    </system.web>
</location>

Regards,
Dimitar Terziev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Ekjot
Top achievements
Rank 1
answered on 16 Apr 2012, 09:12 PM
Hi!

Thanks for the reply. I tried this and it still causes the error. Any other suggestions?
0
Dimitar Terziev
Telerik team
answered on 19 Apr 2012, 02:07 PM
Hi,

After inspecting the code snippet from your web config file I've noticed that you are missing a setting in your service configuration:
<service name="Reena.Master.MasterFormulaWebService">
        <endpoint address="" behaviorConfiguration="Reena.Master.MasterFormulaWebServiceAspNetAjaxBehavior"
          binding="webHttpBinding" contract="Reena.Master.MasterFormulaWebService" />
        <endpoint address="" behaviorConfiguration="Reena.Master.MasterFormulaWebServiceAspNetAjaxBehavior"
                binding="webHttpBinding" bindingConfiguration="secureBinding contract="Reena.Master.MasterFormulaWebService" />
      </service>

Please add the above suggested setting to your configuration and let us know of the results.

Greetings,
Dimitar Terziev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Ekjot
Top achievements
Rank 1
answered on 21 Apr 2012, 12:49 AM
I added the lines you asked in the Web.Config and it is still giving me that error. Http stopped working too now when I added that line :/. 


<system.serviceModel>
    <behaviors>
      <endpointBehaviors>
        <behavior name="Reena.Master.MasterFormulaWebServiceAspNetAjaxBehavior">
          <enableWebScript />
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
 
    <services>
      <service name="Reena.Master.MasterFormulaWebService">
        <endpoint address="" behaviorConfiguration="Reena.Master.MasterFormulaWebServiceAspNetAjaxBehavior" binding="webHttpBinding" bindingConfiguration="secureBinding" contract="Reena.Master.MasterFormulaWebService" />
      </service>
    </services>
    <bindings>
      <webHttpBinding>
        <binding name="webBinding">
          <security mode="None">
          </security>
        </binding>
      </webHttpBinding>
    </bindings>
  </system.serviceModel>
</configuration>
0
Cat Cheshire
Top achievements
Rank 1
answered on 25 Apr 2012, 04:54 PM
You can try the configuration settings described in this article:
http://www.telerik.com/help/aspnet-ajax/combobox-load-on-demand-wcf-service.html
0
Tad
Top achievements
Rank 1
answered on 23 Jan 2013, 04:50 PM
I realize this thread is very old, but I have run into very similar problems with "Server Methox X failed", and found a workaround.

I discovered that the problem was related to having multiple address bindings on the same web site on the server (e.g. www.mydomain.com and mydomain.com bound to the same site).

I worked around the problem (kludgey, but it worked) by replicating the web site in IIS for each binding, so that each site was only bound once (but each pointing to the same code directory).

Forgive me if this has already been reported elsewhere on this support site, but I never found it.  Not sure what the problem in IIS is, or why it was throwing an error, but this workaround got me back in business.

--Tad 
0
Dimitar Terziev
Telerik team
answered on 28 Jan 2013, 04:47 PM
Hi Tad,

The reason for this problem with the web service invocation is indeed related to the settings defined in the web config file as well as the IIS settings. Thank you for sharing your solution with the community.

Regards,
Dimitar Terziev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Scott
Top achievements
Rank 1
answered on 26 Sep 2017, 11:55 AM

Could you please expand on the statement "is indeed related to settings defined in the web.config file as well as IIS settings"?  I am experiencing the same issue and if this is related to settings, could you please tell us :

1. Which settings in the web.config and IIS you are referring to

2. If this is caused by configuration settings, is there an alternative set of settings that would prevent this?

Tags
ComboBox
Asked by
Ekjot
Top achievements
Rank 1
Answers by
Dimitar Terziev
Telerik team
Ekjot
Top achievements
Rank 1
Cat Cheshire
Top achievements
Rank 1
Tad
Top achievements
Rank 1
Scott
Top achievements
Rank 1
Share this question
or