【发布时间】:2011-04-08 06:54:42
【问题描述】:
我正在 .NET 4.0 中开发 REST 服务,这是我的 web.config 文件 我是 .NET 的新手,并且已经苦苦挣扎了两天,以了解为什么我无法上传超过 ~60KB 的数据。
我通过谷歌搜索了解到必须增加 BufferSize 并尝试以不同的方式修改 web.config 文件,但从未奏效。有人能帮我吗。
问候 希特什
<?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="Data
Source=YQLABSSERVER\SQLEXPRESS;Initial
Catalog=Geo;Integrated
Security=True;MultipleActiveResultSets=True""
providerName="System.Data.EntityClient"
/>
</connectionStrings>
</configuration>
【问题讨论】:
-
我格式化了 XML,但也许您可以删除除相关部分之外的所有内容?并贴出一些界面,我们说的是Streams,大数组,....?