2

I get this error and really don't know how to fix it:

The element 'system.serviceModel' has invalid child element 'domainServices'. List of possible elements expected: 'behaviors, bindings, client, comContracts, commonBehaviors, diagnostics, serviceHostingEnvironment, extensions, protocolMapping, services, standardEndpoints, tracking, routing

Config:

<?xml version="1.0"?>
<configuration>
  <configSections>
    <sectionGroup name="system.serviceModel">
      <section name="domainServices" type="System.ServiceModel.DomainServices.Hosting.DomainServicesSection, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" allowDefinition="MachineToApplication" requirePermission="false" />
    </sectionGroup>
  </configSections>    
  <system.serviceModel>
    <domainServices>
      <endpoints>
        <!-- <add name="OData" type="System.ServiceModel.DomainServices.Hosting.ODataEndpointFactory, System.ServiceModel.DomainServices.Hosting.OData, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> -->
        <add name="soap" type="Microsoft.ServiceModel.DomainServices.Hosting.SoapXmlEndpointFactory, Microsoft.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        <!-- <add name="JSON" type="Microsoft.ServiceModel.DomainServices.Hosting.JsonEndpointFactory, Microsoft.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> -->
      </endpoints>
    </domainServices>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceThrottling  maxConcurrentCalls="100"  maxConcurrentSessions="100"  maxConcurrentInstances="10"  />
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
 </configuration>
Jon
  • 16,212
  • 8
  • 50
  • 62
NoWar
  • 36,338
  • 80
  • 323
  • 498
  • 3
    The error indicates that you have a "domainServices" section in your system.serviceModel section. Post your web.config if this hint is not enough for you to figure this out. – GTG Apr 22 '12 at 13:46
  • @GTG OK. I just updated it. Please have a look. Thank you! – NoWar Apr 22 '12 at 18:39
  • 2
    Have you checked [this](http://forums.silverlight.net/t/205849.aspx/1) out? – abatishchev Apr 22 '12 at 19:15

1 Answers1

2

Sometimes this sort of error ("system.ServiceModel has an invalid child element XXXX") can arise if we target an older version of .Net Framework than what is expected. This can be resolved by opening the Project Properties and then modifying the Target framework from the Application tab. Hope this is useful to someone out there.

shivesh suman
  • 1,511
  • 18
  • 26
  • You're really true, i just changed my all Web Projects from .Net framework 4.5 to 4.6.1, and my app.config reference errors was solved! thank you some much. – Leonardo Feb 12 '18 at 06:40