c# - How to pass string value with length more than '500' -


i have made web service receive base64string of image , image name android app . want store data sql server . have problem when pass data web service . here url : http://localhost:36690/api/data/getimage?base64string=/9j/4aaqskzjrgabaqaaaqabaad/2wbdabalda4mchaodq4seratgcgagbywgdejjr0oojm9pdkzoddasfxoqerxrtc4ug1rv19iz2hnpk1xexbkefxlz2p/2wbdaresehgvgc8agi9jqjhcy2njy2njy2njy2njy2njy2njy2njy2njy2njy2njy2njy2njy2njy2njy2njy2njy2p/waarcadiamgdasiaahebaxeb/8qahwaaaqubaqebaqeaaaaaaaaaaaecawqfbgcicqol/8qatraaagedawieawufbaqaaaf9aqidaaqrbrihmuege1fhbyjxfdkbkaeii0kxwrvs0fakm2jyggkkfhcygroljicokso0nty3odk6q0rfrkdisuptvfvwv1hzwmnkzwznaglqc3r1dnd4exqdhiwgh4ijipktljwwl5izmqkjpkwmp6ipqrkztlw2t7i5usldxmxgx8jjytlt1nxw19jz2uhi4+tl5ufo6erx8vp09fb3+pn6/8qahweaawebaqebaqebaqaaaaaaaaecawqfbgcicqol/8qatreaagecbaqdbacfbaqaaqj3aaecaxeebsexbhjbuqdhcrmimoeifekrobhbcsmzuvavynlrchyknoel8rcygromjygpkju2nzg5okneruzhselku1rvvldywvpjzgvmz2hpann0dxz3ehl6gooehyahiimkkpoulzaxmjmaoqokpaanqkmqsro0tba3ulm6wspexcbhymnk0tpu1dbx2nna4upk5ebn6onq8vp09fb3+pn6/9oadambaairaxeapwdg6k6v+zrp/n2j/kj+zrp/aj9o/waqqrnkvp+hv+qhj/1yp8xwx/z1n/z7r/lvhvo0srvzbvrdixclk4jgd/h+laxneius+33n/pzj/wb9ufb7z/n5k/76oa66qmp/8g2f/drnpt97/wa/mn/frqazurie7iimmasn2azwpbfafedb9kwur/s6z/59o/yo/s6z/wcfap8akglnkuh6gus/s6z/aofap8qbp1n/am+8f5ubctd6susf/ef8/mn/ah1r9vvp+fmt/vqgdraudfxrkft95/z8yf8afvh2+8/5+zp++qag3n/h/c/9dw/mairp7aytpbwgwwfgd0dmxgck+v1qt+zrp/n2j/kglnkuv1f9nwf/ad7r/lr/z1n/am+0f5ubcrab/wag3/gzrsrndtlks7ww2rtfhtb2rwm1u+33n/pzj/31qb1tfcl9vvp+fmt/al6o+33n/pzj/wb9uaaxipra/wda/wclfgjj7f532z995enu/ngc5/lrqbt0uuuafzfih/jwt/rqp5gtssvxd/x4j/11h8jqbz9fffmy+kmzshfwcehjq7awbwxucrmpvwyqkrwp/h5h+p8ai1rcskk3f2r6oew0kshkxcv/ag2l0b8h/jr9ti9g/if41rorp2sjr+oue34l37bh/db8h/jsi9jh8l/kp8ao0ue1kh1cj2mwadl/ah0/wj+zpf76/rwnrr7aqfukpmzn9ns/31/wj+zpf76frwnrr7aqfukpmwre5sk2iiynlecngktrv5ibh0nzfrwlbf8ahulau5utazx4vdqpquoxu3bckooory845vxp+qk3+4kz60nc/wcqk3+4kz6eauuuuxmz4c63x/ap60uehot1/waa/rrsebdfc9/b13/zyh/i/wcnh9vxf/pkh8j/ai0by6gsvxd/amecf9dr/i1s/t67/wceup5h/gpred9ac21yfrehmax5bz07k9iaasy1fdb/ynr/am9zvzh+fh9g2v8az1m/mf4ubcxbh/j9j/h+rrxfpbsle1hnrysll7egjnj0pgrmrfee3l/8j+v6iwiiistuciiigaooooakkkkadsa0bb/j3ss6q0msxfviyksiqvhiof51tr3z5+y/w16/5m/rxpf29d/88ofyp+nh9vxf/pkh8j/jxsenyj1z/kjn/ucqfblvajq8f2u4zlkj24j4hh1zun9gwv8az1m/mf4uac/rxqf2da/89zvzh+fh9g2v/pwb8x/hqfydw51uv+af1opbj/irlfsvz+f97zocy6yxj1ooaxakkkywrt8pf8hct/rkf5isytpw9/yejp8arkf5igdoakkkqig7/wcpz/w/nwcp6vo3f/hs/wch86zh/suatv8a15ntzd/cfq/0fooore7wooooakkkkaciiigarfu/+put61tvi3f/ab9yfwtqo7ppzh+gvujooorqphoi0h/kg/8aazwlwbop/in/4ga0qqgooooaxfefw1/4h/sijxh1tf8agf8asigdfort/sg7/wcekh/fr/wo/sg7/wcekh/fr/wpjmytpw9/yejp+ur/mkp7bu/+ekh/ah0f8kmt4h0aq3n0vzghlgrnjytnvj0oa26ky/7ftp8anlp+q/xo/t+0/wceu/5d/gkkxeu/+pz/896zh/sntq1vddyy0ldn/ea7c+tmfc1b4j28u/hp1/rc0uuvidwuuuuaffffabrrrqavi3f/ab9yfwtqqsmj3fw5mr4grcjjp+fbud2efmp8nev+zl0vp/2dd/8apsd/al6p+fh9g3f/ad0g/wc+j/hxueox9a/5bv8awm1pvjw91hpef2s5vmkzuzgmjn3qx+3rt/nlp+q/xpcnsisv+37t/nlp+q/xo/t+0/55t/kp8aasqei+tr/wp+lflcf8tsr9lgzypvebxnptgm+lfag1rrrqavl+if8ajwt/ak6j+rrurl8q/wdhgn/xufynahp0uuuxk1j/amfsf4/yna4risf+p2p8f5gtcvy1vi/rzpay/wdhp1/qwiiistuciiigaooooakkkkadsa0bb/j3ss7sa0bb/j3stapxm8/mf4a/rus0uuv1hjhn65/yem/3bwfwhrn/acem/wbwvn0iaooopjnnw51uv+af1oo8odbr/gh9akqjboqd7zaf8/up/fy/xo+2wn/p1d/32p8aggcesvxd/waecf8axufynxftlp/z9q/99j/gqosul1alhbms7h8lyzuigcon+etagbruv2s8/wcfwf8a79mj7jef8+s//fs0xjrh/j8j/h+rrwhwsf7hd/8aprn/37p+ft2vvpderstqyrxqwlmyeafjwu6fmztw+l9jbxtf5mlrwh9stp8an6h/77h+nh2y0/5+of8avsf41n7hz/a3/tl+5+jn0vofblt/aj+of++x/jr9ttp+fqh/al7h+nhsfp8aap7s/ufiz9fyws7v/n1m/wc/z/wo+x3f/prp/wb+z/ht9h5h/ax938f+abnfy32o7/59z/8av2f8kpsv3/z6z/8afs/4uew8w/tl+7+p/ang9dwna/8ahulqwtzbpaqpjpejqgdkzgeedhepftlp/wa/uh/fy/xqou+v3obeyv20uuw2v9diaioptlp/z9q/99j/abo+2wn/ad9q/wdfy/xru4zb1z/kjn/ucqfawqxyxn6zlanpk2gbowwh6vs+yxn/ad6z/wdfs0aikipfsl5/z6z/apfs0fzlz/n1n/79mmm1pdnw6/4b/wil0t/rpp8atx7jft2+b8ucz6z+tfiriyhokmd0flrtgjgegru8pf8aiqk/65h+yrmrt8pf8hct/rkf5igdoakkkqgqrqf/acdp/wddq1vxu/8akht/ao7qbyg6uyhokb0h0payxmd0fb6glpd0nahbull3pkqgpr1/gkpr1/ggdj7zm/uf+ujfznq4hokmvp8aj/uf+urfznruxiyhokmd0flrqb0wg/8ain/4ga0qzdb/5bv/aam1puhbrrrqbiei/wdl1/4f/sijxh1tf+b/0ooaxqktd9an31pjcttw/wd8f8n/afyp8xwvn61qehj/akfif+mr/mkqjoqkkkacqup/8g6f/dq1vxu/+qdp/u0acoog+lltqqbs7vrtglshoan31pcrg0adv3pku0liquo6/jsuo60acfef8f1z/wbdw/mahqa8ol65/wcujfznqz+tadqktd9an31pjoj0h/kg/wdazwlwdop/acdh/vmtgkikkkkamtxh1tf+b/0oo8r/8ux/3v6uuaav2o1/59of++b/hr9jtf8an2h/74h+ftuuaq/y7x/n2h/74h+fz+solraljbkixmgbambsrg9x/nitasvxd/x4j/11h8jqbi/blr/n5m/7+gj7zdf8/m3/ah8nq0uxk32y6/5+zv8av4ansriea9hilmkkjzggvmjbqlvjtv8aki2/++kaom+x2v8az7q/98cj7ha/8+0p/fa/wqaikih+x2v/ad7q/wdfa/wofna/8+0p/fsf4vnsjrqbx4vlrh/hzn/38nl9suv+fmb/al+gof6utmzn9suv+fmb/v4adexqbp2mb/v4ahpd0p0oa6q1tojlsf5ii3dkbzmqek9e9s/y7x/n2h/74h+ffj/x4w//afyx+vtuhep2o1/59of++b/hr9jtf+fah/vgf4vnrqbzuqysw160du7qx7qdsz2j9kp/blr/aj+zv+/hqzrn/isb/cfukarn9suv+fmb/v4aptl1/wa/m3/fw1drtgbwif6x5/2r9/s27fm+bhxpmik8odbr/gh9akqjbooooaky/ep/ab4j/wbdr/i1qvl+if8ajwt/ak6j+roa5+ik49qopammwrgnf8hg3/3xvbj2qzp3oo2/++kaosooopcclhwkpr1oa4lellsl0o49qyxaq9d9kopag9dqb19j/waefv8a9cl/lu1q2p8ax4w3/xjf5vnseffffahna5/yem/3bvcr+ucak2f7grp49qaqtfjx7uce1mztehot1/wd+tfhhz/l6/4b/wikig/tu7/uxf8afj/xo/tu7/uxf98n/gs2imm0v7bu/wc7f/3yf8amtz31iq211grqpmhljbznhu545rhrt8pf8hct/rkf5igc9/yvp/el/wc+h/hr/yvp/el/76h+fadfirmf2faf3pf++h/htjtngsynuojizivmxcqr+va1vdt/aoqdp/u0ay41y7i+7h/3yf8agj+27v8auxf98n/gswdb9kwmm0v7bu/7sx/fj/xpp7cuwobf/wb8n/gs6kpq0adf/yvp/el/76h+fh9hwn96x/vof4vqd6skizp7ctp70v8a30p8kp7ctp70v/fq/wak06udfxoa559vubar7emj5clffyvoacdv7u3+27v+7f/3yf8agqv5/waf9z/11b+zqkmm0v7bu/7sx/fj/waap7bu/wc7f/3yf8azakany2ty9wi+1xjyse7fk4hhspf7ctp70v8a30p8kxqf+qb/amdnavirmf2faf3pf++h/hr/yvp/el/76h+fadfagjdf8sxz9kjpn53b+cy+mpwijxh1tf8agf8asigdgooopjctpw9/yejp+ur/mkkkaohooopccqup/wdion/3akkaouhqfsloopjckpq0uuadt3pkkkqgpr1/giigdj7z/j/uf+urfznruuuxhrrrqb0wg/8ain/4ga0qkkqgooooaxfefw1/4h/siiigd//z&imgname=dddd

and here problem enter image description here

and here webservice

[httpget] [actionname("getimage")] public string getimage(string base64string, string imgname) {     try     {          using (phnetworkentities context = new phnetworkentities())         {             pic pic = new pic();             pic.path = base64string;             pic.picname = imgname;             context.pics.add(pic);             context.savechanges();             return "success";         }      }     catch (dbentityvalidationexception ex)     {         // retrieve error messages list of strings.         var errormessages = ex.entityvalidationerrors                 .selectmany(x => x.validationerrors)                 .select(x => x.errormessage);          // join list single string.         var fullerrormessage = string.join("; ", errormessages);          // combine original exception message new one.         var exceptionmessage = string.concat(ex.message, " validation errors are: ", fullerrormessage);          // throw new dbentityvalidationexception improved exception message.         throw new dbentityvalidationexception(exceptionmessage, ex.entityvalidationerrors);     } } 

i'm not sure if code problem or web.config , here web.config

<?xml version="1.0" encoding="utf-8"?> <configuration>   <configsections>     <section name="entityframework" type="system.data.entity.internal.configfile.entityframeworksection, entityframework, version=5.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" requirepermission="false" />   </configsections>   <connectionstrings>      <add name="phnetworkentities" connectionstring="metadata=res://*/models.model1.csdl|res://*/models.model1.ssdl|res://*/models.model1.msl;provider=system.data.sqlclient;provider connection string=&quot;data source=androiddb;initial catalog=phnetwork;integrated security=true;multipleactiveresultsets=true;application name=entityframework&quot;" providername="system.data.entityclient" /></connectionstrings>   <appsettings>     <add key="webpages:version" value="2.0.0.0" />     <add key="webpages:enabled" value="false" />     <add key="preserveloginurl" value="true" />     <add key="clientvalidationenabled" value="true" />     <add key="unobtrusivejavascriptenabled" value="true" />   </appsettings>   <system.web>     <compilation debug="true" targetframework="4.5" />     <httpruntime targetframework="4.5" maxquerystringlength="2097151" maxurllength="2097151" maxrequestlength="2097151" />     <authentication mode="none" />       <pages>       <namespaces>         <add namespace="system.web.helpers" />         <add namespace="system.web.mvc" />         <add namespace="system.web.mvc.ajax" />         <add namespace="system.web.mvc.html" />         <add namespace="system.web.optimization" />         <add namespace="system.web.routing" />         <add namespace="system.web.webpages" />       </namespaces>     </pages>     <profile defaultprovider="defaultprofileprovider">       <providers>         <add name="defaultprofileprovider" type="system.web.providers.defaultprofileprovider, system.web.providers, version=1.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" connectionstringname="defaultconnection" applicationname="/" />       </providers>     </profile>     <membership defaultprovider="defaultmembershipprovider">       <providers>         <add name="defaultmembershipprovider" type="system.web.providers.defaultmembershipprovider, system.web.providers, version=1.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" connectionstringname="defaultconnection" enablepasswordretrieval="false" enablepasswordreset="true" requiresquestionandanswer="false" requiresuniqueemail="false" maxinvalidpasswordattempts="5" minrequiredpasswordlength="6" minrequirednonalphanumericcharacters="0" passwordattemptwindow="10" applicationname="/" />       </providers>     </membership>     <rolemanager defaultprovider="defaultroleprovider">       <providers>         <add name="defaultroleprovider" type="system.web.providers.defaultroleprovider, system.web.providers, version=1.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" connectionstringname="defaultconnection" applicationname="/" />       </providers>     </rolemanager>     <sessionstate mode="inproc" customprovider="defaultsessionprovider">       <providers>         <add name="defaultsessionprovider" type="system.web.providers.defaultsessionstateprovider, system.web.providers, version=1.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" connectionstringname="defaultconnection" />       </providers>     </sessionstate>   </system.web>   <system.webserver>      <validation validateintegratedmodeconfiguration="false" />     <handlers>       <remove name="extensionlessurlhandler-isapi-4.0_32bit" />       <remove name="extensionlessurlhandler-isapi-4.0_64bit" />       <remove name="extensionlessurlhandler-integrated-4.0" />       <add name="extensionlessurlhandler-isapi-4.0_32bit" path="*." verb="get,head,post,debug,put,delete,patch,options" modules="isapimodule" scriptprocessor="%windir%\microsoft.net\framework\v4.0.30319\aspnet_isapi.dll" precondition="classicmode,runtimeversionv4.0,bitness32" responsebufferlimit="0" />       <add name="extensionlessurlhandler-isapi-4.0_64bit" path="*." verb="get,head,post,debug,put,delete,patch,options" modules="isapimodule" scriptprocessor="%windir%\microsoft.net\framework64\v4.0.30319\aspnet_isapi.dll" precondition="classicmode,runtimeversionv4.0,bitness64" responsebufferlimit="0" />       <add name="extensionlessurlhandler-integrated-4.0" path="*." verb="get,head,post,debug,put,delete,patch,options" type="system.web.handlers.transferrequesthandler" precondition="integratedmode,runtimeversionv4.0" />     </handlers>   <security>      <requestfiltering>       <requestlimits maxquerystring="5000000" maxallowedcontentlength="500000000" />     </requestfiltering>   </security>    </system.webserver>    <runtime>     <assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1">       <dependentassembly>         <assemblyidentity name="system.web.helpers" publickeytoken="31bf3856ad364e35" />         <bindingredirect oldversion="1.0.0.0-2.0.0.0" newversion="2.0.0.0" />       </dependentassembly>       <dependentassembly>         <assemblyidentity name="system.web.mvc" publickeytoken="31bf3856ad364e35" />         <bindingredirect oldversion="1.0.0.0-4.0.0.0" newversion="4.0.0.0" />       </dependentassembly>       <dependentassembly>         <assemblyidentity name="system.web.webpages" publickeytoken="31bf3856ad364e35" />         <bindingredirect oldversion="1.0.0.0-2.0.0.0" newversion="2.0.0.0" />       </dependentassembly>       <dependentassembly>         <assemblyidentity name="entityframework" publickeytoken="b77a5c561934e089" />         <bindingredirect oldversion="1.0.0.0-5.0.0.0" newversion="5.0.0.0" />       </dependentassembly>       <dependentassembly>         <assemblyidentity name="webgrease" publickeytoken="31bf3856ad364e35" />         <bindingredirect oldversion="1.0.0.0-1.3.0.0" newversion="1.3.0.0" />       </dependentassembly>     </assemblybinding>   </runtime>    <entityframework>     <defaultconnectionfactory type="system.data.entity.infrastructure.sqlconnectionfactory, entityframework" />   </entityframework>  </configuration> 

please advice . thank time .

modify "getimage" , try calling web service sending string len < 500

then can see problem it's ef problem , not web service problem.

[actionname("getimage")] public string getimage(string base64string, string imgname) {     try     {          using (phnetworkentities context = new phnetworkentities())         {             pic pic = new pic();             pic.path = new string('*', 502); // modify!! fails!!!             pic.picname = imgname;             context.pics.add(pic);             context.savechanges();             return "success";         }      }     catch (dbentityvalidationexception ex)     {        // same question...     } } 

maybe it's auto-generated code. check design of table "pics" in database, prop of column path nvarchar(500) or varchar(500) ?

or maybe search in "phnetworkentities" max length assigned pic.path


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -