我只是在应用本文中的代码,
http://msdn.microsoft.com/zh-CN/library/ms733766(v=vs.110).aspx
我没有进行任何更改,但是从IIS浏览后,我得到了
The contract name 'IMetadataExchange' could not be found in the list of contracts implemented by the service CalculatorService. Add a ServiceMetadataBehavior to the configuration file or to the ServiceHost directly to enable support for this contract
可能出了什么问题,我只是做了链接。我寻找答案。我可以通过添加
<behaviors>
<serviceBehaviors>
<behavior name="CalculatorServiceBehavior">
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
但我不想添加此内容,因为在查看链接时,msdn不会添加。这是什么错误?
这是我的配置文件:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<services>
<service name="Microsoft.ServiceModel.Samples.CalculatorService">
<!-- This endpoint is exposed at the base address provided by host: http://localhost/servicemodelsamples/service.svc -->
<endpoint address=""
binding="wsHttpBinding"
contract="Microsoft.ServiceModel.Samples.ICalculator" />
<!-- The mex endpoint is explosed at http://localhost/servicemodelsamples/service.svc/mex -->
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
</configuration>
我找不到任何官方文件,证明之间的关系<serviceMetadata>
和IMetadataExchange
。
只是示例中的以下注释<serviceMetadata>
:
<!-- the mex endpoint is exposed at http://localhost/servicemodelsamples/service.svc/mex
To expose the IMetadataExchange contract, you
must enable the serviceMetadata behavior as demonstrated below -->
它说“您必须”,但没有参考。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句