元数据不会出现

时间:2012-03-20 14:35:05

标签: wcf configuration metadata

我正在尝试创建一个WCF服务,但是没有出现元数据,我尝试:

<system.serviceModel>
  <services>
    <service 
      name ="MyNamespace.IMyContract"
      behaviorConfiguration="mex">
      <endpoint         
        address = ""         
        binding = "wsHttpBinding"    
        contract = "MyNamespace.IMyContract"       
        />
    </service>
  </services>
  <behaviors>
    <serviceBehaviors>
      <behavior name="mex">
        <serviceMetadata httpGetEnabled="true" />
      </behavior>
    </serviceBehaviors>
  </behaviors>
  <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>

我尝试使用http://MyServer/receptor.svc访问,但显示Metadata publishing for this service is currently disabled.http://MyServer/mex显示404,为什么?我做错了什么?

OBS1:我在Windows 7上的IIS7.5中发布我的服务。

OBS2:如果我删除了behaviorConfiguration="mex",则元数据可以正常工作,但basicHttpBinding不能使用wsHttpBinding

1 个答案:

答案 0 :(得分:0)

我忘记了:

<endpoint address="mex"
          binding="mexHttpBinding"
          contract="IMetadataExchange" />