【发布时间】:2016-02-03 00:26:51
【问题描述】:
我有一个简单的 JavaScript JSON 请求,它是一个通过 JSON 请求发送到我的 C# Web 服务器的对象。
只要 stringy 返回的字符串超过 1180 个字符,就不会在服务器上调用 WebMethod。
据我了解,客户端可以通过 JSON 发送多少字符串数据是没有限制的。我知道限制在服务器端,试图接受参数化的请求。
我可以在 web.config 中的某个地方增加这个 1180 的限制吗?
我当前的配置;
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;initial catalog=aspnetdb" providerName="System.Data.SqlClient"/>
<add name="ApplicationServices2" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;initial catalog=trimweb" providerName="System.Data.SqlClient"/>
<add name="ApplicationServices3" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;initial catalog=Customers" providerName="System.Data.SqlClient"/>
<add name="ApplicationServices4" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;initial catalog=OrderUpdate;User ID=test1;Password=test1;" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<behaviors>
<endpointBehaviors>
<behavior name="webHttpBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding name="webHttpBindingWithJsonP" crossDomainScriptAccessEnabled="true" />
</webHttpBinding>
</bindings>
<services>
<service name="ServiceSite.CustomersService">
<endpoint address="" binding="webHttpBinding"
bindingConfiguration="webHttpBindingWithJsonP" contract="ServiceSite.CustomersService"
behaviorConfiguration="webHttpBehavior"/>
</service>
</services>
</system.serviceModel>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
【问题讨论】:
标签: json web-config webmethod svc