2012-04-20 86 views
2

我得到這個錯誤,真不知道如何解決它:system.serviceModel具有無效的子元素domainServices

元素'system.serviceModel具有無效的子元素 「domainServices」。預期可能元素的列表:「行爲, 綁定,客戶端,comContracts,commonBehaviors,診斷, serviceHostingEnvironment,擴展protocolMapping,服務, standardEndpoints,跟蹤路由

配置:

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

該錯誤表明您的system.serviceModel部分中有「domainServices」部分。發佈你的web.config,如果這個提示不足以讓你弄清楚。 – GTG 2012-04-22 13:46:36

+0

@GTG好的。我剛剛更新了它。請看一看。謝謝! – 2012-04-22 18:39:29

+2

您是否檢查過[this](http://forums.silverlight.net/t/205849.aspx/1)? – abatishchev 2012-04-22 19:15:47

回答

2

如果我們的目標是早期版本的.Net Framework,可能會出現這種錯誤(「system.ServiceModel有一個無效的子元素XXXX」)。這可以通過打開項目屬性然後從應用程序選項卡修改目標框架來解決。希望這對那裏的人有用。

+0

你真的是真的,我只是將我的所有Web項目從.NET Framework 4.5更改爲4.6.1,並且我的app.config引用錯誤已解決!非常感謝你。 – Leonardo 2018-02-12 06:40:41

相關問題