2015-12-17 101 views
0

在我的web.config文件中我已经定义了以下服务:WCF服务端点配置不喜欢绑定属性

<services> 
    <service name="ShareYourWage.Service.WageService" behaviorConfiguration ="metadataBehavior"> 
    <endpoint> 
     binding="basicHttpBinding" 
     contract="ShareYourWage.Service.IWageService"> 
    </endpoint> 
    </service> 
</services> 

然而,当我调试服务,测试客户端引发以下错误:

Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata. 

和挖掘到特定错误指向端点部分显示以下错误:

The configuration section cannot contain a CDATA or text element. 

我谷歌搜索这个错误和MSDN网站,并使用他们的例子,仍然有这个问题。第二双眼睛会很大帮助,谢谢!

+0

不确定,但我认为元数据是通过启用IMetadataExchange合同公开的。 http://wcftutorial.net/metadata-exchange-endpoint.aspx –

回答

1

您不小心关闭了endpoint标签之前的bindingcontract属性。

删除'>'在<endpoint>的末尾。

你希望它是这样的:

<endpoint 
    binding="basicHttpBinding" 
    contract="ShareYourWage.Service.IWageService"> 
</endpoint> 

如果你正在使用Visual Studio或其他一些XML的文本编辑器修改配置文件,语法高亮可以为察觉这些种类有帮助的问题。