none
Question about WCF Service RRS feed

  • Question

  • Hi,

    I am working with my first WCF service, running in the manner of a WebService, i.e. with http binding.

    I am getting an System.Configuration.ConfigurationErrorsException when I try to run it from the client. The message is

    "The binding at system.serviceModel/bindings/basicHttpBinding does not have a configured binding named 'BasicHttpBinding_IDocumentLibraryService'. This is an invalid value for bindingConfiguration."

    Looking at my Client side configuration, I seem to have the endpoint set up correctly, as 

        <system.serviceModel>

            <bindings>

                <basicHttpBinding>

                    <binding name="BasicHttpBinding_IDocumentLibraryService" closeTimeout="00:01:00"

                        openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"

                        allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"

                        maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"

                        messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"

                        useDefaultWebProxy="true">

                        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"

                            maxBytesPerRead="4096" maxNameTableCharCount="16384" />

                        <security mode="None">

                            <transport clientCredentialType="None" proxyCredentialType="None"

                                realm="" />

                            <message clientCredentialType="UserName" algorithmSuite="Default" />

                        </security>

                    </binding>

                 </basicHttpBinding>

            </bindings>

            <client>

                <endpoint address="http://localhost:100/DocumentLibraryService.svc"

                    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IDocumentLibraryService"

                    contract="DocumentLibraryService.IDocumentLibraryService"

                    name="BasicHttpBinding_IDocumentLibraryService" />

            </client>

        </system.serviceModel>

    (that is in app.config on my client.

    But on the server, where the Web service actually resides, I have published it and followed all instructions to publish it to IIS (version 7) and it seems to be all there. However, there does not seem to be any endpoint code in the web.config file, and I suspect this is the source of the error. the relevant section of my web.config is pasted below, and as you can see there is no reference to my service at all:

     <system.serviceModel>

        <behaviors>

          <serviceBehaviors>

            <behavior>

              <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->

              <serviceMetadata httpGetEnabled="true" />

              <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->

              <serviceDebug includeExceptionDetailInFaults="false" />

            </behavior>

          </serviceBehaviors>

        </behaviors>

        <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

      </system.serviceModel>

    I'm quite surprised that this is missing altogether, as I generated this code and published it entirely using Visual Studio/Visual Basic 2010 and NET framework 4, and usually things concerning 'plumbing' tend to be generated automatically, even if they can be customised. But nothing here. Does the endpoint on the Client have to be put into web.config by hand, or is there something that I have missed out in setting this up.

    Would be very grateful for any help with this.

     

    Thanks

     

    Ian


    --- Ian
    Wednesday, February 9, 2011 11:30 AM

Answers

  • The service is using a feature new in .NET 4 called Default Endpoints where unless you explicitly supply endpoints it builds them for you - one for each base address. For HTTP it defaults to the BasicHttpBinding. This is why you don;t see any endpoints in the service code

    The error you are getting comes from the client code - the generated proxy configuration appears to have problems. Can you try to update your service reference in the client and see if that fixes the problem?


    Richard Blewett, thinktecture - http://www.dotnetconsult.co.uk/weblog2
    Twitter: richardblewett
    • Marked as answer by IanJDudley Wednesday, February 9, 2011 11:57 AM
    Wednesday, February 9, 2011 11:40 AM
    Moderator

All replies

  • The service is using a feature new in .NET 4 called Default Endpoints where unless you explicitly supply endpoints it builds them for you - one for each base address. For HTTP it defaults to the BasicHttpBinding. This is why you don;t see any endpoints in the service code

    The error you are getting comes from the client code - the generated proxy configuration appears to have problems. Can you try to update your service reference in the client and see if that fixes the problem?


    Richard Blewett, thinktecture - http://www.dotnetconsult.co.uk/weblog2
    Twitter: richardblewett
    • Marked as answer by IanJDudley Wednesday, February 9, 2011 11:57 AM
    Wednesday, February 9, 2011 11:40 AM
    Moderator
  • Thanks for that. Problem sorted.
    --- Ian
    Wednesday, February 9, 2011 11:57 AM