WCF Service Reference Support Files Not Updating

 

Questions


I have a VS 2010 solution containing a WCF service project and a unit test project. The unit test project has a service reference to the WCF service.

Web.config for the WCF service project sets a number of binding attributes to other-than-default values:

web.config: (Specifically note maxBufferSize=”20000000“)

<basicHttpBinding>
    <binding name="basicHttpBindingConfig" maxReceivedMessageSize="20000000" maxBufferSize="20000000" maxBufferPoolSize="20000000">
      <readerQuotas maxDepth="32" maxArrayLength="200000000" maxStringContentLength="200000000"/>
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Ntlm"/>
      </security>
    </binding>
</basicHttpBinding>

While examining this issue, I came to realize that the unit test project’s service reference support files do not contain the values I would expect (i.e. the values configured in the WCF service’s web.config):

configuration.svcinfo:
(Specifically note maxBufferSize=”65536“)

  <binding hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" messageEncoding="Text" name="BasicHttpBinding_IBishopService" textEncoding="utf-8" transferMode="Buffered">
    <readerQuotas maxArrayLength="16384" maxBytesPerRead="4096" maxDepth="32" maxNameTableCharCount="16384" maxStringContentLength="8192" />
    <security mode="None">
      <message algorithmSuite="Default" clientCredentialType="UserName" />
      <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
    </security>
  </binding>

Deleting and re-creating the service reference or updating the service reference re-creates the files, but I still end up with the same values.

Why?

Update

Here’s the app.config of the client

<binding name="BasicHttpBinding_IMyService" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="200000000" maxBufferPoolSize="200000000" maxReceivedMessageSize="200000000"
                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                    useDefaultWebProxy="true">
                    <readerQuotas maxDepth="32" maxStringContentLength="200000000" maxArrayLength="200000000"
                        maxBytesPerRead="200000000" maxNameTableCharCount="200000000" />
                    <security mode="None">
                        <transport clientCredentialType="None" proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="UserName" algorithmSuite="Default" />
                    </security>
                </binding>

 

 

————————————————-

Answer

Same issue here and no solution after half a day messing about with config files… Changing automatically generated files is usually frowned upon, so my feeling says that “there has got to be a better way, Dennis”.

UPDATE: I got my problem fixed by removing the name attribute in the binding configuration.
So your current web.config is looking like this

<basicHttpBinding>
  <binding name="basicHttpBindingConfig" maxReceivedMessageSize="20000000" maxBufferSize="20000000" maxBufferPoolSize="20000000">
    <readerQuotas maxDepth="32" maxArrayLength="200000000" maxStringContentLength="200000000"/>
    <security mode="TransportCredentialOnly">
      <transport clientCredentialType="Ntlm"/>
    </security>
  </binding>
</basicHttpBinding>

would become

<basicHttpBinding>
  <binding maxReceivedMessageSize="20000000" maxBufferSize="20000000" maxBufferPoolSize="20000000">
    <readerQuotas maxDepth="32" maxArrayLength="200000000" maxStringContentLength="200000000"/>
    <security mode="TransportCredentialOnly">
      <transport clientCredentialType="Ntlm"/>
    </security>
  </binding>
</basicHttpBinding>

I think you only need to this at the client-side. By removing the name attribute, you essentially change the default basicHttpBinding configuration for your app, as far as I understand it. Credits for this solution here.

Another update: if you name your service configuration correctly (including the namespace) it will pick up the binding configuration. So instead of

<service name="ServiceName">

you need

<service name="My.Namespace.ServiceName">

wcf,wcf-binding

Facebook Comments

Post a comment