system.serviceModel 具有无效的子元素域服务

本文关键字:元素 服务 无效 serviceModel system | 更新日期: 2023-09-27 18:31:53

我收到此错误,但真的不知道如何解决它:

元素 'system.serviceModel' 具有无效的子元素 "域名服务"。预期的可能元素列表:"行为, 绑定, 客户端, comContracts, commonBehaviors, diagnostics, 服务托管环境, 扩展, 协议映射, 服务, 标准端点、跟踪、路由

配置:

<?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>

system.serviceModel 具有无效的子元素域服务

有时会出现这种错误("系统。ServiceModel 有一个无效的子元素 XXXX")如果我们针对的旧版本的 .Net Framework 而不是预期的,则可能会出现这种情况。可以通过打开"项目属性",然后从"应用程序"选项卡修改"目标"框架来解决此问题。希望这对那里的人有用。