Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I am trying to pass data across different domain using jsonp.
Code to call my service
JavaScript
$.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
HTML
<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
Comments
ZurdoDev 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.
Dexter11 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

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
XML
<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[^]
 
Share this answer
 
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900