WCF:在IDE创建的服务上配置maxbuffersize

时间:2013-05-31 07:24:32

标签: c# wcf visual-studio-2012

过去,我使用WCF的经验总是基于Castle Windsor及其WCF工具,在那里配置绑定参数非常容易。

在这个项目中,我需要使用Visual Studio(Project - > Add new item - > WCF服务)使用那些自动生成的WCF代码隐藏方法。 现在我需要在服务器端调整绑定的maxbuffersize参数,但Visual Studio为我生成的唯一配置是以下(Web.config):

<system.serviceModel>
  <behaviors>
    <serviceBehaviors>
      <behavior name="">
        <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="true" />
      </behavior>
    </serviceBehaviors>
  </behaviors>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>

我想知道Visual Studio不会生成任何绑定或端点配置。通过Web.config附加特定绑定的最佳方法是什么?

如果有可能,我会支持基于XML的配置,而不是以编程方式调整绑定参数。

提前谢谢。

1 个答案:

答案 0 :(得分:2)

<bindings>
    <basicHttpBinding>
        <binding name="*********" maxBufferSize="2147483647">
    <basicHttpBinding>
<bindings>

也许这会有所帮助。