WCF service - Minimum required web.config?

11,153

You need these basic nodes in your service's web.config files usually. Of Course the binding types / dedub config / etc is all just for testing. You need to fine tune it as per your needs

<system.serviceModel>
        <services>
            <service name="A.B.C.D" behaviorConfiguration="returnFaults">
                <endpoint contract="A.B.C.ID" binding="basicHttpBinding" address=""/>
            </service>
        </services>
        <bindings>
            <basicHttpBinding>
                <binding name="HttpBinding" maxReceivedMessageSize="2097152">
                </binding>
            </basicHttpBinding>
        </bindings>
        <behaviors>
            <serviceBehaviors>
                <behavior name="returnFaults">
                    <serviceDebug includeExceptionDetailInFaults="true"/>
                    <serviceMetadata httpGetEnabled="true"/>
                </behavior>
            </serviceBehaviors>
        </behaviors>
    </system.serviceModel>
Share:
11,153
Jon
Author by

Jon

Senior developer at Envoy.

Updated on June 04, 2022

Comments

  • Jon
    Jon almost 2 years

    I have a simple WCF service (hosted as its own site in IIS). It was originally developed targeting .NET 4 but I have recently discovered that it needs to be downgraded to .NET 3.5.

    I never touched the web.config file and it Just Worked. Now that I've changed the project from .NET 4 back to 3.5 I'm getting config errors. The first one was about multipleSiteBindingsEnabled not being recognised - a quick search tells me this is new in .NET 4 so I just deleted it. Now the error I'm getting is:

    Service 'MyService' has zero application (non-infrastructure) endpoints. This might be because no configuration file was found for your application, or because no service element matching the service name could be found in the configuration file, or because no endpoints were defined in the service element.

    I just want to get the service responding so I can test firing things at it. The system that will be consuming the service doesn't exist yet (it's currently being developed by a government department) so once that's closer to completion we'll be worrying about the config that will be needed for it to go into production etc. What's the minimum config I need in the web.config to make it work for testing?

  • Jake
    Jake about 11 years
    how about the other sections?