很抱歉发布这个,但它让我发疯。我在 VS2010 的 WCF4 REST 模板中使用路由。我将 maxreceivedmessagesize 属性设置为某个庞大的数字,当我尝试将 xml 提交给服务时,它仍然给我一个 HTTP 状态代码 400。我打开了跟踪,消息告诉我它仍设置为默认消息大小。这让我觉得问题在于我的 web.config 设置方式有些细微差别。有人可以快速了解一下,让我知道他们的想法吗?
我一直在这个周围,多一双眼睛会对我有很大的好处。提前致谢!
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</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>
<bindings>
<webHttpBinding>
<binding name="" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" transferMode="Streamed" openTimeout="00:25:00" closeTimeout="00:25:00" sendTimeout="00:25:00" receiveTimeout="00:25:00" maxBufferSize="2147483647">
<readerQuotas maxDepth="64"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647"/>
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<dataContractSerializer maxItemsInObjectGraph="9000000"/>
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<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" maxReceivedMessageSize="2147483647" transferMode="Streamed" maxBufferPoolSize="2147483647" maxBufferSize="2147483647"/>
</webHttpEndpoint>
</standardEndpoints>
</system.serviceModel>
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "c:\logs\Traces.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
</configuration>