jquery - WCF GET URL Length Limit Issue: Bad Request - Invalid URL -
i tried access wcf service through jquery ajax phone call method. so, url lengthy parameters.
when parameters becomes lengthy, jquery ajax phone call fails, , returns nothing. set break point , took url out test. when seek same url in browser (i tried firefox , chrome), returns next when url length long.
bad request - invalid url
http error 400. request url invalid.
i checked length limitation well. when number of characters in url (in encoded format) exceeds 1011 characters (including http://) error.
anyone has same situation , found solution this? windows limitation or can managed through settings programmatically?
i tried post method, don't know not create work. because needs web.config changes.
edit
the url have tested generate error
http://localhost:64973/member.svc/savememberwithdetail/%7b%22id%22%7c%222%22,%22typeid%22%7c%222%22,%22title%22%7c%22mr.%22,%22firstname%22%7c%22firnas%22,%22middlename%22%7c%22%22,%22lastname%22%7c%22aliyar%22,%22gender%22%7c%221%22,%22dateofbirth%22%7c%222000-01-01%22,%22nationality%22%7c%22sri%20lankan%22%7d/%5b%7b%22addressline1%22%7c%22changed%20address%20line1%22,%22addressline2%22%7c%22colombo%22,%22city%22%7c%22colombo%2010%22,%22state%22%7c%22wp%22,%22postcode%22%7c%2201000%22,%22countryid%22%7c%221%22,%22id%22%7c%227%22,%22typeid%22%7c%221%22%7d%5d/%5b%7b%22telephone%22%7c%22015154645%22,%22typeid%22%7c%221%22%7d%5d/%5b%7b%22emailaddress%22%7c%22gen1@dfs%22,%22id%22%7c%2226%22,%22typeid%22%7c%221%22%7d,%7b%22emailaddress%22%7c%22gen2@jfasd%22,%22id%22%7c%2227%22,%22typeid%22%7c%221%22%7d,%7b%22emailaddress%22%7c%22g1@e.cm%22,%22id%22%7c%2228%22,%22typeid%22%7c%221%22%7d,%7b%22emailaddress%22%7c%22g2@gogle.com%22,%22id%22%7c%2229%22,%22typeid%22%7c%221%22%7d,%7b%22emailaddress%22%7c%22g@go.com%22,%22id%22%7c%2229%22,%22typeid%22%7c%221%22%7d%5d/%7b%7d/481
unencoded version of url:
http://localhost:64973/member.svc/savememberwithdetail/{"id"|"2","typeid"|"2","title"|"mr.","firstname"|"firnas","middlename"|"","lastname"|"aliyar","gender"|"1","dateofbirth"|"2000-01-01","nationality"|"sri lankan"}/[{"addressline1"|"changed address line1","addressline2"|"colombo","city"|"colombo 10","state"|"wp","postcode"|"01000","countryid"|"1","id"|"7","typeid"|"1"}]/[{"telephone"|"015154645","typeid"|"1"}]/[{"emailaddress"|"gen1@dfs","id"|"26","typeid"|"1"},{"emailaddress"|"gen2@jfasd","id"|"27","typeid"|"1"},{"emailaddress"|"g1@e.cm","id"|"28","typeid"|"1"},{"emailaddress"|"g2@gogle.com","id"|"29","typeid"|"1"},{"emailaddress"|"g@go.com","id"|"29","typeid"|"1"}]/{}/481
my parameters set of json objects. don't think of characters cause problem, because, if cut down few alpha numeric characters less limit, works.
i'm running application in visual studio 2012 premium in windows 8 professional, it's .net 4.5 , iis express came it.
further research
when seek investigate further, not limitation have mentioned length of total url. but, there limitation of length in each parameter 260 characters.
so, i'm not sure url total length, each parameter (seperated "/") has limit. problem above url have posted email address json parameter 261 characters long, given below.
[{"emailaddress"|"gen1@dfs","id"|"26","typeid"|"1"},{"emailaddress"|"gen2@jfasd","id"|"27","typeid"|"1"},{"emailaddress"|"g1@e.cm","id"|"28","typeid"|"1"},{"emailaddress"|"g2@gogle.com","id"|"29","typeid"|"1"},{"emailaddress"|"g@go.com","id"|"29","typeid"|"1"}]
if delete 1 character this, works.
is browser limitation? os limitation?
update: solution
i found solution worked me, when research farther on this. i'm updating here since might useful others come across question.
this iis setting
the problem because, default character limit of each parameter in rest url 260 defined in registry.
so, have update registry increment size limit iis server / iis express running.
following location of registry:
hkey_local_machine\system\currentcontrolset\services\http\parameters
and value name urlsegmentmaxlength
. if not there, create 1 type of reg_dword
. , specify higher value value data
such 1000 in hexadecimal or 4096 in decimal.
this http.sys setting. more http.sys settings : http://support.microsoft.com/kb/820129
make sure, restart server/machine apply registry changes. , that's it.
reposting update answer, since of might jump straight answers section.
i found solution worked me, when research farther on this. i'm updating here since might useful others come across question.
this iis setting
the problem because, default character limit of each parameter in rest url 260 defined in registry.
so, have update registry increment size limit iis server / iis express running.
following location of registry:
hkey_local_machine\system\currentcontrolset\services\http\parameters , value name urlsegmentmaxlength. if not there, create 1 type of reg_dword. , specify higher value value info such 1000 in hexadecimal or 4096 in decimal.
this http.sys setting. more http.sys settings : http://support.microsoft.com/kb/820129
make sure, restart server/machine apply registry changes. , that's it.
jquery ajax wcf browser get
No comments:
Post a Comment