首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >WCF 400大数据错误请求

WCF 400大数据错误请求
EN

Stack Overflow用户
提问于 2010-09-05 01:59:38
回答 2查看 4.7K关注 0票数 2

我正在用.NET 4.0开发REST服务,这是我的web.config文件,我是.NET的新手,两天来一直在努力理解为什么我不能上传超过60KB的数据。

我通过谷歌了解到,BufferSize必须增加,并尝试以不同的方式修改web.config文件,但从未奏效。谁能帮帮我。

关于Hitesh

代码语言:javascript
复制
 <?xml version="1.0" encoding="utf-8"?>
 <configuration>   <system.web>
     <compilation debug="true" targetFramework="4.0">
       <assemblies>
         <add assembly="System.Data.Entity,
 Version=4.0.0.0, Culture=neutral,
 PublicKeyToken=b77a5c561934e089" />
       </assemblies>
     </compilation> <httpRuntime maxRequestLength="1048576"/>  
 </system.web>   <system.webServer>
     <modules runAllManagedModulesForAllRequests="true">
       <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0,
 Culture=neutral,
 PublicKeyToken=b03f5f7f11d50a3a" />
     </modules>   </system.webServer>   <system.serviceModel>
     <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
     <standardEndpoints>
       <webHttpEndpoint>
         <!-- 
             Configure the WCF REST service base address via the
 global.asax.cs file and the default
 endpoint 
             via the attributes on the <standardEndpoint> element below
         -->
         <standardEndpoint name="" helpEnabled="true"
 automaticFormatSelectionEnabled="true"
 />
       </webHttpEndpoint>
     </standardEndpoints> <services>

 <service name=""
 behaviorConfiguration="UpdateRealtimeWebPortfolioStructure.Service1Behavior"
 > <!-- Service Endpoints -->

 <endpoint address=""
 binding="wsHttpBinding"
 contract="UpdateRealtimeWebPortfolioStructure.IService1"
 bindingConfiguration="higherMessageSize_WS"><!--
 Upon deployment, the following
 identity element should be removed or
 replaced to reflect the

 identity under which the deployed
 service runs. If removed, WCF will
 infer an appropriate identity

 automatically.

 --> <identity>

 <dns value="localhost" /> </identity>

 </endpoint> <endpoint address="mex"
 binding="mexHttpBinding"
 contract="IMetadataExchange"
 bindingConfiguration="higherMessageSize_MEX"/>

 </service> </services>

 <bindings> <wsHttpBinding>

 <binding name="higherMessageSize_WS"
 closeTimeout="10:01:00"

 openTimeout="10:01:00"
 receiveTimeout="10:10:00"
 sendTimeout="10:01:00"

 bypassProxyOnLocal="false"
 transactionFlow="false"
 hostNameComparisonMode="StrongWildcard"

 maxBufferPoolSize="524288000"
 maxReceivedMessageSize="65536000"
 messageEncoding="Text"

 textEncoding="utf-8"
 useDefaultWebProxy="true"
 allowCookies="false"></binding>
 </wsHttpBinding>

 <mexHttpBinding> <binding
 name="higherMessageSize_MEX" />

 </mexHttpBinding>


 </bindings><behaviors>
 <serviceBehaviors>

 <behavior name=""> <!-- To avoid
 disclosing metadata information, set
 the value below to false and remove
 the metadata endpoint above before
 deployment -->

 <serviceMetadata httpGetEnabled="true"
 /> <dataContractSerializer
 maxItemsInObjectGraph="2147483647"/>

 <!-- To receive exception details in
 faults for debugging purposes, set the
 value below to true. Set to false
 before deployment to avoid disclosing
 exception information -->
 <serviceDebug
 includeExceptionDetailInFaults="false"
 />

 </behavior> </serviceBehaviors>

 </behaviors>   </system.serviceModel> 
 <connectionStrings>
     <add name="GeoContainer" connectionString="metadata=res://*/Geo.csdl|res://*/Geo.ssdl|res://*/Geo.msl;provider=System.Data.SqlClient;provider
 connection string=&quot;Data
 Source=YQLABSSERVER\SQLEXPRESS;Initial
 Catalog=Geo;Integrated
 Security=True;MultipleActiveResultSets=True&quot;"
 providerName="System.Data.EntityClient"
 />   
 </connectionStrings>
 </configuration>
EN

回答 2

Stack Overflow用户

发布于 2010-09-05 04:39:11

我认为在使用ASP.NET兼容性的REST场景中增加消息大小所需的唯一system.serviceModel配置更改是:

代码语言:javascript
复制
<system.serviceModel>
  <bindings>
    <!-- default binding configration used for all REST services -->
    <webHttpBinding>
      <!-- max allowed message size incresed to 500 000 Bytes -->
      <binding maxBufferSize="500000" maxReceivedMessageSize="500000" />
    </webHttpBinding>
  </bindings>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>
票数 3
EN

Stack Overflow用户

发布于 2010-09-06 11:07:30

我通过在<serviceEndPoint>标签中添加maxBufferSize头得到了解决方案。现在它工作正常了

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3643387

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档