Getting bad request (400) on solr

I am facing a weird problem with solr . I am getting bad request(400) error when requesting a url with HttpWebRequest(C#)

We are using below code HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(solrFinalUrl); HttpWebResponse response = ttpWebResponse)request.GetResponse(); Stream receiveStream = response.GetResponseStream(); StreamReader readStream = new StreamReader(receiveStream,Encoding.UTF8); String jsonString = readStream.ReadToEnd();

But when I am hitting the url on browser it's giving expected result.

Request Url --
http://__________:8080/solr-4.10.3/lemars/select?start=0&rows=10&q=*%3A*&fq=%20(date:[1887-08-01T00:00:00Z%20TO%201887-08-31T23:59:59Z])%20(date:[1888-08-01T00:00:00Z%20TO%201888-08-31T23:59:59Z])%20(date:[1889-08-01T00:00:00Z%20TO%201889-08-31T23:59:59Z])%20(date:[1890-08-01T00:00:00Z%20TO%201890-08-31T23:59:59Z])%20(date:[1891-08-01T00:00:00Z%20TO%201891-08-31T23:59:59Z])%20(date:[1892-08-01T00:00:00Z%20TO%201892-08-31T23:59:59Z])%20(date:[1893-08-01T00:00:00Z%20TO%201893-08-31T23:59:59Z])%20(date:[1894-08-01T00:00:00Z%20TO%201894-08-31T23:59:59Z])%20(date:[1895-08-01T00:00:00Z%20TO%201895-08-31T23:59:59Z])%20(date:[1896-08-01T00:00:00Z%20TO%201896-08-31T23:59:59Z])%20(date:[1897-08-01T00:00:00Z%20TO%201897-08-31T23:59:59Z])%20(date:[1898-08-01T00:00:00Z%20TO%201898-08-31T23:59:59Z])%20(date:[1899-08-01T00:00:00Z%20TO%201899-08-31T23:59:59Z])%20(date:[1900-08-01T00:00:00Z%20TO%201900-08-31T23:59:59Z])%20(date:[1901-08-01T00:00:00Z%20TO%201901-08-31T23:59:59Z])%20(date:[1902-08-01T00:00:00Z%20TO%201902-08-31T23:59:59Z])%20(date:[1903-08-01T00:00:00Z%20TO%201903-08-31T23:59:59Z])%20(date:[1904-08-01T00:00:00Z%20TO%201904-08-31T23:59:59Z])%20(date:[1905-08-01T00:00:00Z%20TO%201905-08-31T23:59:59Z])%20(date:[1906-08-01T00:00:00Z%20TO%201906-08-31T23:59:59Z])%20(date:[1907-08-01T00:00:00Z%20TO%201907-08-31T23:59:59Z])%20(date:[1908-08-01T00:00:00Z%20TO%201908-08-31T23:59:59Z])%20(date:[1909-08-01T00:00:00Z%20TO%201909-08-31T23:59:59Z])%20(date:[1910-08-01T00:00:00Z%20TO%201910-08-31T23:59:59Z])%20(date:[1911-08-01T00:00:00Z%20TO%201911-08-31T23:59:59Z])%20(date:[1912-08-01T00:00:00Z%20TO%201912-08-31T23:59:59Z])%20(date:[1913-08-01T00:00:00Z%20TO%201913-08-31T23:59:59Z])%20(date:[1914-08-01T00:00:00Z%20TO%201914-08-31T23:59:59Z])%20(date:[1915-08-01T00:00:00Z%20TO%201915-08-31T23:59:59Z])%20(date:[1916-08-01T00:00:00Z%20TO%201916-08-31T23:59:59Z])%20(date:[1917-08-01T00:00:00Z%20TO%201917-08-31T23:59:59Z])%20(date:[1918-08-01T00:00:00Z%20TO%201918-08-31T23:59:59Z])%20(date:[1919-08-01T00:00:00Z%20TO%201919-08-31T23:59:59Z])%20(date:[1920-08-01T00:00:00Z%20TO%201920-08-31T23:59:59Z])%20(date:[1921-08-01T00:00:00Z%20TO%201921-08-31T23:59:59Z])%20(date:[1922-08-01T00:00:00Z%20TO%201922-08-31T23:59:59Z])%20(date:[1923-08-01T00:00:00Z%20TO%201923-08-31T23:59:59Z])%20(date:[1924-08-01T00:00:00Z%20TO%201924-08-31T23:59:59Z])%20(date:[1925-08-01T00:00:00Z%20TO%201925-08-31T23:59:59Z])%20(date:[1926-08-01T00:00:00Z%20TO%201926-08-31T23:59:59Z])%20(date:[1927-08-01T00:00:00Z%20TO%201927-08-31T23:59:59Z])%20(date:[1928-08-01T00:00:00Z%20TO%201928-08-31T23:59:59Z])%20(date:[1929-08-01T00:00:00Z%20TO%201929-08-31T23:59:59Z])%20(date:[1930-08-01T00:00:00Z%20TO%201930-08-31T23:59:59Z])%20(date:[1931-08-01T00:00:00Z%20TO%201931-08-31T23:59:59Z])%20(date:[1932-08-01T00:00:00Z%20TO%201932-08-31T23:59:59Z])%20(date:[1933-08-01T00:00:00Z%20TO%201933-08-31T23:59:59Z])%20(date:[1934-08-01T00:00:00Z%20TO%201934-08-31T23:59:59Z])%20(date:[1935-08-01T00:00:00Z%20TO%201935-08-31T23:59:59Z])%20(date:[1936-08-01T00:00:00Z%20TO%201936-08-31T23:59:59Z])%20(date:[1937-08-01T00:00:00Z%20TO%201937-08-31T23:59:59Z])%20(date:[1938-08-01T00:00:00Z%20TO%201938-08-31T23:59:59Z])%20(date:[1939-08-01T00:00:00Z%20TO%201939-08-31T23:59:59Z])%20(date:[1940-08-01T00:00:00Z%20TO%201940-08-31T23:59:59Z])%20(date:[1941-08-01T00:00:00Z%20TO%201941-08-31T23:59:59Z])%20(date:[1942-08-01T00:00:00Z%20TO%201942-08-31T23:59:59Z])%20(date:[1943-08-01T00:00:00Z%20TO%201943-08-31T23:59:59Z])%20(date:[1944-08-01T00:00:00Z%20TO%201944-08-31T23:59:59Z])%20(date:[1945-08-01T00:00:00Z%20TO%201945-08-31T23:59:59Z])%20(date:[1946-08-01T00:00:00Z%20TO%201946-08-31T23:59:59Z])%20(date:[1947-08-01T00:00:00Z%20TO%201947-08-31T23:59:59Z])%20(date:[1948-08-01T00:00:00Z%20TO%201948-08-31T23:59:59Z])%20(date:[1949-08-01T00:00:00Z%20TO%201949-08-31T23:59:59Z])%20(date:[1950-08-01T00:00:00Z%20TO%201950-08-31T23:59:59Z])%20(date:[1951-08-01T00:00:00Z%20TO%201951-08-31T23:59:59Z])%20(date:[1952-08-01T00:00:00Z%20TO%201952-08-31T23:59:59Z])%20(date:[1953-08-01T00:00:00Z%20TO%201953-08-31T23:59:59Z])%20(date:[1954-08-01T00:00:00Z%20TO%201954-08-31T23:59:59Z])%20(date:[1955-08-01T00:00:00Z%20TO%201955-08-31T23:59:59Z])%20(date:[1956-08-01T00:00:00Z%20TO%201956-08-31T23:59:59Z])%20(date:[1957-08-01T00:00:00Z%20TO%201957-08-31T23:59:59Z])%20(date:[1958-08-01T00:00:00Z%20TO%201958-08-31T23:59:59Z])%20(date:[1959-08-01T00:00:00Z%20TO%201959-08-31T23:59:59Z])%20(date:[1960-08-01T00:00:00Z%20TO%201960-08-31T23:59:59Z])%20(date:[1961-08-01T00:00:00Z%20TO%201961-08-31T23:59:59Z])%20(date:[1962-08-01T00:00:00Z%20TO%201962-08-31T23:59:59Z])%20(date:[1963-08-01T00:00:00Z%20TO%201963-08-31T23:59:59Z])%20(date:[1964-08-01T00:00:00Z%20TO%201964-08-31T23:59:59Z])%20(date:[1966-08-01T00:00:00Z%20TO%201966-08-31T23:59:59Z])%20(date:[1967-08-01T00:00:00Z%20TO%201967-08-31T23:59:59Z])%20(date:[1968-08-01T00:00:00Z%20TO%201968-08-31T23:59:59Z])%20(date:[1969-08-01T00:00:00Z%20TO%201969-08-31T23:59:59Z])%20(date:[1970-08-01T00:00:00Z%20TO%201970-08-31T23:59:59Z])%20(date:[1971-08-01T00:00:00Z%20TO%201971-08-31T23:59:59Z])%20(date:[1972-08-01T00:00:00Z%20TO%201972-08-31T23:59:59Z])%20(date:[1973-08-01T00:00:00Z%20TO%201973-08-31T23:59:59Z])%20(date:[1974-08-01T00:00:00Z%20TO%201974-08-31T23:59:59Z])%20(date:[1975-08-01T00:00:00Z%20TO%201975-08-31T23:59:59Z])%20(date:[1976-08-01T00:00:00Z%20TO%201976-08-31T23:59:59Z])%20(date:[1977-08-01T00:00:00Z%20TO%201977-08-31T23:59:59Z])%20(date:[1978-08-01T00:00:00Z%20TO%201978-08-31T23:59:59Z])%20(date:[1979-08-01T00:00:00Z%20TO%201979-08-31T23:59:59Z])%20(date:[1980-08-01T00:00:00Z%20TO%201980-08-31T23:59:59Z])%20(date:[1981-08-01T00:00:00Z%20TO%201981-08-31T23:59:59Z])%20(date:[1982-08-01T00:00:00Z%20TO%201982-08-31T23:59:59Z])%20(date:[1983-08-01T00:00:00Z%20TO%201983-08-31T23:59:59Z])%20(date:[1984-08-01T00:00:00Z%20TO%201984-08-31T23:59:59Z])%20(date:[1985-08-01T00:00:00Z%20TO%201985-08-31T23:59:59Z])%20(date:[1986-08-01T00:00:00Z%20TO%201986-08-31T23:59:59Z])%20(date:[1987-08-01T00:00:00Z%20TO%201987-08-31T23:59:59Z])%20(date:[1988-08-01T00:00:00Z%20TO%201988-08-31T23:59:59Z])%20(date:[1989-08-01T00:00:00Z%20TO%201989-08-31T23:59:59Z])%20(date:[1990-08-01T00:00:00Z%20TO%201990-08-31T23:59:59Z])%20(date:[1991-08-01T00:00:00Z%20TO%201991-08-31T23:59:59Z])%20(date:[1992-08-01T00:00:00Z%20TO%201992-08-31T23:59:59Z])%20(date:[1993-08-01T00:00:00Z%20TO%201993-08-31T23:59:59Z])%20(date:[1994-08-01T00:00:00Z%20TO%201994-08-31T23:59:59Z])%20(date:[1995-08-01T00:00:00Z%20TO%201995-08-31T23:59:59Z])%20(date:[1996-08-01T00:00:00Z%20TO%201996-08-31T23:59:59Z])%20(date:[1997-08-01T00:00:00Z%20TO%201997-08-31T23:59:59Z])%20(date:[1998-08-01T00:00:00Z%20TO%201998-08-31T23:59:59Z])%20(date:[1999-08-01T00:00:00Z%20TO%201999-08-31T23:59:59Z])%20(date:[2000-08-01T00:00:00Z%20TO%202000-08-31T23:59:59Z])%20(date:[2001-08-01T00:00:00Z%20TO%202001-08-31T23:59:59Z])%20(date:[2002-08-01T00:00:00Z%20TO%202002-08-31T23:59:59Z])%20(date:[2003-08-01T00:00:00Z%20TO%202003-08-31T23:59:59Z])%20(date:[2004-08-01T00:00:00Z%20TO%202004-08-31T23:59:59Z])%20(date:[2005-08-01T00:00:00Z%20TO%202005-08-31T23:59:59Z])%20(date:[2006-08-01T00:00:00Z%20TO%202006-08-31T23:59:59Z])%20(date:[2007-08-01T00:00:00Z%20TO%202007-08-31T23:59:59Z])%20(date:[2008-08-01T00:00:00Z%20TO%202008-08-31T23:59:59Z])%20(date:[2009-08-01T00:00:00Z%20TO%202009-08-31T23:59:59Z])%20(date:[2010-08-01T00:00:00Z%20TO%202010-08-31T23:59:59Z])%20(date:[2011-08-01T00:00:00Z%20TO%202011-08-31T23:59:59Z])%20(date:[2012-08-01T00:00:00Z%20TO%202012-08-31T23:59:59Z])&fl=filename%2Ctitle%2CfileContent%2Cdate%2Ccity%2Cstate%2Cpagenum&wt=json&indent=true&facet=true&facet.range=date&facet.range.start=1887-01-01T00:00:00Z/MONTH&facet.range.end=2012-12-31T23:59:59Z/MONTH%2B1MONTH&facet.range.gap=%2B1DAY

Please help.


You can analyze http packages by wireshark. Compare if there are any different between connect from c# application and browser.

链接地址: http://www.djcxy.com/p/45898.html

上一篇: Square Connect API列表位置和库存调整返回404找不到

下一篇: 在solr上获得错误的请求(400)