如何增加请求uri长度wcf休息服务web.config文件? [英] How to increase request uri length wcf rest service web.config file?

查看:61
本文介绍了如何增加请求uri长度wcf休息服务web.config文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发了WCF服务来从android应用程序交互SQL Server数据库。对于正常的交互它工作正常但是当我尝试发布大数据时它抛出414错误。这是我的代码:



I had developed WCF service to interact SQL Server database from android application.For normal interaction it was working fine but when i try to post large data it was throwing 414 error.Here is my code:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
         <httpRuntime maxQueryStringLength="2097151" maxUrlLength="2097151" />
    </system.web>
<connectionStrings>
    <add name="DBConnection" connectionString="Integrated Security=true;Data Source=LENOVO\SQLEXPRESS;Initial Catalog=SCHOOLDB" providerName="System.Data.SqlClient" />
  </connectionStrings>

  <system.serviceModel>
      <services>
      <service name="FusilMobileServices.MobileServices" behaviorConfiguration="ServiceBehaviour">
        <endpoint address="" binding="webHttpBinding" contract="FusilMobileServices.IMobileServices" behaviorConfiguration="web">
        <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
      </service>
    </services>

      <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehaviour">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="web">
          <webHttp/>
        </behavior>
      </endpointBehaviors>
    </behaviors>

  </system.serviceModel>

<system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

 <system.webServer>
   <security>
     <requestFiltering>
       <requestLimits maxAllowedContentLength="2147483647" maxUrl="2097151" maxQueryString="2097151" />
     </requestFiltering>
   </security>
  </system.webServer>
</configuration>

推荐答案

您需要增加<的值web.config文件中的code> maxReceivedMessageSize 属性。



http://wildermuth.com/2009/09/10/Using_Large_Message_Requests_in_Silverlight_with_WCF [ ^ ]

https://msdn.microsoft.com/en-us/library/system.servicemodel.basichttpbinding.maxreceivedmessagesize%28v=vs.100 %29.aspx [ ^ ]
You need to increase the value for the maxReceivedMessageSize attribute in your web.config file.

http://wildermuth.com/2009/09/10/Using_Large_Message_Requests_in_Silverlight_with_WCF[^]
https://msdn.microsoft.com/en-us/library/system.servicemodel.basichttpbinding.maxreceivedmessagesize%28v=vs.100%29.aspx[^]


这篇关于如何增加请求uri长度wcf休息服务web.config文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆