WCF,合同名称'IMetadataExchange接口'找不到 [英] WCF, The contract name 'IMetadataExchange' could not be found

查看:1000
本文介绍了WCF,合同名称'IMetadataExchange接口'找不到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是从这篇文章中应用代码,



http://msdn.microsoft.com/en-us/library/ms733766(v = vs.110)的.aspx



我没有改变什么,但在IIS浏览后我得到

 合同名称IMetadataExchange接口无法通过该服务CalculatorService的实施合同的名单上找到。一个的ServiceMetadataBehavior添加到配置文件或直接ServiceHost的,使本合同
支持



可能是什么错了,我就照链接。我搜索了一个答案。我可以通过添加



处理

 <&行为GT; 
< serviceBehaviors>
<行为NAME =CalculatorServiceBehavior>
< serviceMetadata httpGetEnabled =真/>
< serviceDebug includeExceptionDetailInFaults =FALSE/>
< /行为>
< / serviceBehaviors>
< /行为>



但我不希望添加这个,因为在看MSDN链接时不添加。 ?什么是误差



下面是我的配置文件:

  < XML版本=1.0编码=UTF-8>?; 
<结构>
< system.serviceModel>
<服务和GT;
<服务名称=Microsoft.ServiceModel.Samples.CalculatorService>

< - 此端点在由主机提供的基地址暴露:HTTP://localhost/servicemodelsamples/service.svc - >
<端点地址=
结合=的wsHttpBinding
合同=Microsoft.ServiceModel.Samples.ICalculator/>

< - MEX终结点是在HTTP explosed://localhost/servicemodelsamples/service.svc/mex - >
<端点地址=MEX
结合=mexHttpBinding
合同=IMetadataExchange接口/>
< /服务>
< /服务>
< /system.serviceModel>

< /结构>


解决方案

我找不到任何官方文件,证明的关系之间的< serviceMetadata> IMetadataExchange接口



有关的 < serviceMetadata>

 <  -  MEX终结点暴露在http://localhost/servicemodelsamples/service.svc/mex 
。要揭露IMetadataExchange接口的合同,你
必须启用serviceMetadata行为表现出如下 - >



它说:你必须,但还没有参考。


I am simply applying code from this article,

http://msdn.microsoft.com/en-us/library/ms733766(v=vs.110).aspx

I did not change anything but after browsing from IIS I am getting

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

What may be wrong, I did just as the link. I searched for an answer. I can handle by adding

  <behaviors>
      <serviceBehaviors>
        <behavior name="CalculatorServiceBehavior">
          <serviceMetadata httpGetEnabled="True"/>
          <serviceDebug includeExceptionDetailInFaults="False" />
        </behavior>
      </serviceBehaviors>
    </behaviors>

But I do not want to add this because when looking at the link msdn does not add. What is the error?

Here is my config file:

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

解决方案

I couldn't find any official document stating the relation between <serviceMetadata> and IMetadataExchange.

Just this comment inside the example for <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 -->

It says "You MUST", but no reference yet.

这篇关于WCF,合同名称'IMetadataExchange接口'找不到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆