Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: JSONP
I am trying to pass data across different domain using jsonp.
Code to call my service
$.ajax({
    type: "GET",
    url: window.serviceURL + "CheckWebsite",
    data: {
         domain: domainName, 
         website: sitename 
     },
    dataType: "jsonp",
    contentType: "application/json; charset=utf-8",
    success: function (data) {},
   error: function (jqXHR, textStatus, errorThrown) {
        if (window.console) console.log("Error... " + textStatus + "        " + errorThrown);
    }
});
 
First i hosted this service on IIS6 and passed data up to length of 3000 and it worked fine,now i moved my service to IIS7 .The service work properly on IIS7 even even but it does not allow me to pass 3000 characters at a time instead the url length is limited to 2000 now. Do i have to make any additional settings for IIS7
 
Below is my web.config
<configuration><system.web.extensions>
<scripting>
  <webServices>
    <jsonSerialization maxJsonLength="5000" />
  </webServices>
</scripting></system.web.extensions><connectionStrings><add name="connectionString" connectionString="Data Source=sql2\\yukon;Initial Catalog=TMS_20110623;User id=sa; password=sa;" /></connectionStrings><appSettings><add key="connectString" value="Data Source=sql4;Initial Catalog=vbr;User id=sa; password=sa;" /></appSettings><system.web><compilation debug="true" targetFramework="4.0" /><httpRuntime enable="true" maxQueryStringLength="50000" maxUrlLength="100000" maxRequestLength="100000" /></system.web><system.serviceModel><standardEndpoints><webScriptEndpoint><standardEndpoint name="" crossDomainScriptAccessEnabled="true" /></webScriptEndpoint><webHttpEndpoint<standardEndpoint name="" helpEnabled="True" automaticFormatSelectionEnabled="true" />
  </webHttpEndpoint>
</standardEndpoints>
<bindings>
  <webHttpBinding>
    <binding crossDomainScriptAccessEnabled="true">
    </binding>
  </webHttpBinding>
</bindings>
<services>
  <service name="RestService.RestServiceImpl" behaviorConfiguration="ServiceBehaviour">
            <endpoint address="" binding="webHttpBinding" contract="RestService.IRestServiceImpl" behaviorConfiguration="web">
             </endpoint>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="ServiceBehaviour">
               <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
  <endpointBehaviors>
    <behavior name="web">
      <webHttp />
    </behavior>
  </endpointBehaviors>
</behaviors>
 </system.serviceModel><system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
    <defaultDocument>
        <files>
            <add value="Test1.aspx" />
        </files>
    </defaultDocument>
    <httpProtocol>
        <customHeaders>
            <add name="Access-Control-Allow-Origin" value="*" />
        </customHeaders>
    </httpProtocol></system.webServer></configuration>
Posted 10-Jan-13 2:32am
Comments
ryanb31 at 10-Jan-13 8:05am
   
I have seen this before but do not remember it. If you google the error that you get when you try to pass too much I think you'll find your answer pretty quick.
sneha kavinkar at 10-Jan-13 8:28am
   
I get this error
Failed to load resource: the server responded with a status of 404 (Not Found)
and really didn't found anything helpful on google

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

you can increase the size of the query by incresing the maxJsonLength.
Please try adding following code to the web.config file. if you need any help please send a message
<configuration>
	<system.web.extensions>
		<scripting>
			<webservices>
				<jsonserialization maxjsonlength="102400" />
			</webservices>
		</scripting>
	</system.web.extensions>
</configuration>
 
you may like to read following article also
http://www.codeproject.com/script/Articles/MemberArticles.aspx?amid=9709891[^]
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 304
1 Maciej Los 285
2 Sergey Alexandrovich Kryukov 255
3 Shweta N Mishra 216
4 PIEBALDconsult 174
0 OriginalGriff 7,660
1 Sergey Alexandrovich Kryukov 7,072
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,760


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 10 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100