Web Service is not called by Ajax

I`m trying to call to Web Service from ajax and get string array in return,but whatever that i do ,i got 404 error in console log.

This is my client code:

        url: "http://localhost:55397/WebService1.asmx/GetList",
        cache: false, type: "POST", contentType: "application/json; charset=utf-8",

        dataType: 'json',
        success: function (data) {
            tags = data.d;
        error: function () { alert("AutoComplete Server not found");}

and this is my Web Service code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using ExpressDeal.Models;
using ExpressDeal.Controllers;
using System.Web.Script.Services;

namespace ExpressDeal
    /// <summary>
    /// Summary description for WebService1
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 

    public class WebService1 : System.Web.Services.WebService
        private BaseLogic bl = new BaseLogic();

        [ System.Web.Script.Services.ScriptMethodAttribute()]
        //[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Xml)]
        public string [] GetList()
            return bl.Context.Items.Select(i=>i.Name).ToArray();

Can anyone tell me what wrong with it and how to make it work?

Download web.service.is.not.called.by.ajax.zip
Direct Link


Download web.service.is.not.called.by.ajax.zip


Download web.service.is.not.called.by.ajax.zip


Both comments and pings are currently closed.

Comments are closed.