1
Vote

Camlex not working in WebMethod asp.net 3.5

description

Here is my web method that I call with help of Ajax JQuery. When sending a request I receive 500 error.
Commenting string
string caml = Query () Where (x => (string) x [ "Title"] = ""!) .ToString ().;
and Web method works get a 200 response.
In the console application it works but in web method CAMLEX does not work. Please tell me why?
 [WebMethod]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public static int CountPromotions(string listName, string configTags)
        {
            using (SPWeb web = new SPSite(SPContext.Current.Web.Url).OpenWeb())
            {
                SPList list = web.Lists[listName];
                var query = new SPQuery();
                string caml =
                    Camlex.Query()
                        .Where(x => (string)x["Title"] != "").ToString();

                query.Query = caml;
                SPListItemCollection listcol = list.GetItems(query);

                return listcol.Count;
            }

        }

comments