How do I fix a "Request format is unrecognized for URL..." error in a web service running in IIS?
Solution 1:
Since HTTP GET and HTTP POST are disabled by default try adding the following to your config file:
<configuration>
<system.web>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
</system.web>
</configuration>
Solution 2:
I've got the same issue. To solve it add [ScriptService] to your service
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Script.Services;
using System.Web.Services;
namespace DemosAjaxcontroltoolkit
{
/// <summary>
/// Summary description for WebService
/// </summary>
[ScriptService]
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class WebService : System.Web.Services.WebService
{
[System.Web.Script.Services.ScriptMethod()]
[WebMethod]
public string[] GetWords(string prefixText, int count)
{
List<string> words = new List<string>();
words.Add("Apple");
words.Add("Appertizer");
words.Add("Apple tree");
words.Add("Apple Cider");
words.Add("Afternoon");
words.Add("Morning");
words.Add("Breakfeast");
words.Add("Lunch");
words.Add("Spider");
words.Add("Morning");
words.Add("Day");
words.Add("Travel");
words.Add("Night");
words.Add("Car");
words.Add("Bikes");
words.Add("Love");
words.Add("Good");
//return words.Where(w => w.StartsWith(prefixText)).Take(count).ToList();
//List<string> returnedList = words.Where(w => w.StartsWith(prefixText)).Take(count).ToList();
return words.Where(w => w.ToUpper().StartsWith(prefixText.ToUpper())).ToArray();
}
}
}
}