[英]WCF service endpoint configuration doesn't like the binding attribute
In my web.config file I have the following service defined: 在我的web.config文件中,定义了以下服务:
<services>
<service name="ShareYourWage.Service.WageService" behaviorConfiguration ="metadataBehavior">
<endpoint>
binding="basicHttpBinding"
contract="ShareYourWage.Service.IWageService">
</endpoint>
</service>
</services>
Yet, when I debug the service, the test client throws the following error: 但是,当我调试服务时,测试客户端会引发以下错误:
Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.
and digging into the specific error points to the endpoint section shows the following error: 并深入到端点部分的特定错误点将显示以下错误:
The configuration section cannot contain a CDATA or text element.
I've Googled this error and the MSDN site and have used their examples and still have this problem. 我已经搜索了此错误和MSDN站点,并使用了它们的示例,但仍然存在此问题。 A 2nd pair of eyes would be big help, thanks!
第二双眼睛会很有帮助,谢谢!
You accidentally closed your endpoint
tag before the binding
and contract
attributes. 您在
binding
和contract
属性之前意外关闭了endpoint
标记。
Remove the '>' at the end of <endpoint>
. 删除
<endpoint>
末尾的“>”。
You want it to be like this: 您希望它像这样:
<endpoint
binding="basicHttpBinding"
contract="ShareYourWage.Service.IWageService">
</endpoint>
If you're using Visual Studio or some other XML-aware text editor to modify the config files, the syntax highlighting can be helpful for spotting these kinds of problems. 如果您使用的是Visual Studio或其他支持XML的文本编辑器来修改配置文件,则语法突出显示有助于发现此类问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.