I have a ASP.NET webforms project in .NET 3.5 running locally on my machine hosting an ASMX web service. The web service works fine when called from Ajax in IE8, however, using Firefox and Chrome do not work.
The jQuery code is:
$.post("http://localhost:64284/StockService.asmx/DeleteStock",
{ stockId: '"' + code + '"' });
Code is a previous value retrieved from a form element.
This service works fine when invoked from Internet Explorer. It does not work from Chrome or Firefox. I have also tried the $.ajax which doesn't work either.
Firebug shows "OPTIONS DeleteStock" in the Net panel which I find odd as that is the name of the service method. I'd of expected to see POST StockService.asmx however I'm new to jQuery Ajax.
The consuming application is a web forms project, also running on my machine but on another port, but running .NET 4.
Can anyone give any advice? The service is defined as:
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
[System.Web.Script.Services.ScriptService]
public class StockService: System.Web.Services.WebService
// ...
[WebMethod]
public JimStock[] DeleteStock(string stockId)
{
// ...
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…