我已经设置了一个WCF Web服务,可以从我的网站上调用.它工作得很好,但是如果我请求大量数据(不确定大小,但它比我正在返回的"标准"数据容易3-4倍),Cassini(Visual Studio Web Server)就会关闭没有发送任何东西的反应 - 没有错误或任何 事件日志中没有任何内容.只是虚无...
我是WCF的新手,但我知道必须有一些我在这里缺少的配置选项(如消息/响应最大大小/限制)来解决我的问题.这是我的web.config部分的样子:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<behaviors>
<endpointBehaviors>
<behavior name="securetmhAspNetAjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="tmhsecureBehavior">
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="securetmh">
<endpoint address="" behaviorConfiguration="securetmhAspNetAjaxBehavior" binding="webHttpBinding" contract="securetmh" />
</service>
</services>
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud)
任何帮助,将不胜感激.
出于安全原因,WCF默认将服务调用返回的数据限制为64 K.
你可以明显地改变这一点 - 有大量的条目可以调整.请在此处查看此示例配置:
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="customWebHttp"
maxBufferPoolSize="256000"
maxReceivedMessageSize="256000"
maxBufferSize="256000">
<readerQuotas
maxArrayLength="256000"
maxStringContentLength="256000"/>
</binding>
</webHttpBinding>
</bindings>
<services>
<service name="YourService">
<endpoint name="test"
address="....."
binding="webHttpBinding"
bindingConfiguration="customWebHttp"
contract="IYourService" />
</service>
</services>
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud)
您需要定义一个自定义绑定配置基础上webHttpBinding,你可以调整所有这些不同的设置-我把它们全部设置为256K(而不是64K).
希望这可以帮助!
| 归档时间: |
|
| 查看次数: |
739 次 |
| 最近记录: |