0
下面的代碼拋出WCF的Web.Config - 複製服務名稱投擲的錯誤
命名爲相同的密鑰「服務」子元素已經存在於相同的配置範圍的誤差。集合元素在相同的配置範圍內必須是唯一的(例如相同的application.config文件)。重複鍵值:'Marius.Marius_0_0_8'。
現在顯然有兩個名爲Marius.Marius_0_0_8的服務。但是,當我嘗試將其中一個名稱更改爲其他名稱時,我得到了一個不同的錯誤。我假設這是因爲該名稱必須與.svc中的名稱空間&類的名稱匹配。
我很累,一直盯着這幾個小時。我究竟做錯了什麼?我所要做的就是打開元數據,以便連接WCF測試客戶端。
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.5.1" />
<httpRuntime targetFramework="4.5.1" />
<customErrors mode="Off" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="Marius.PublishTheMetaData" >
<!-- Add the following element to your service behavior configuration. -->
<serviceMetadata httpGetEnabled="true" policyVersion="Policy15" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="Marius.MariusAspNetAjaxBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
<services>
<service name="Marius.Marius_0_0_8">
<endpoint address="" behaviorConfiguration="Marius.MariusAspNetAjaxBehavior"
binding="webHttpBinding" contract="Marius.Marius_0_0_8" />
</service>
<service name ="Marius.Marius_0_0_8" behaviorConfiguration="Marius.PublishTheMetaData">
<endpoint name="mex"
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
</configuration>