danielmcn
danielmcn

Reputation: 415

Providing configuration for some named WCF services in <services> while leaving the rest defaulted?

I have a number of WCF services (10+) which work alright, but I have one Document service which needs higher limits.

I can specify a nameless HTTP Binding and that works ok, but will apply the settings to every service

<binding maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text">
  <readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>

However if give this one a named (eg name="LargeHttpBinding") and try to specify the single service in the services block...

<services>
  <service name="My.Service.Name">
    <endpoint binding="webHttpBinding" bindingConfiguration="LargeHttpBinding" contract="My.Service.IName" />
  </service>
</services>

... then nothing will work, presumably as it now means every service would have to be individually named in services? Is there any way to have one service listed in and have the result default as normal, or would they all have to be listed in if at least one is?

Upvotes: 0

Views: 33

Answers (1)

James Johnson
James Johnson

Reputation: 46067

I'm a little bit confused, but couldn't you just have two bindings -- the nameless binding to be used as the default, and the named binding to be applied specifically to the service that needs it?

<binding messageEncoding="Text">
  <readerQuotas maxDepth="2000000" />
</binding>
<binding name="SpecificBinding" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text">
  <readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>

This way, the nameless binding would be used as the default, and named binding would only apply to the service that specifies that binding configuration name.

Upvotes: 1

Related Questions