错误:无法从WCF服务获取元数据 [英] Error: Cannot obtain Metadata from WCF service

查看:977
本文介绍了错误:无法从WCF服务获取元数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个成功运行WCF服务,我可以调用使用JavaScript。不过,我想使用WCF测试客户端和IM有困难,这样做是为了调用它。有人告诉我,我需要确保我已经启用元数据发布在指定的地址。看完我只是不能看到什么意思即时通讯要做到这一点的文件后是我的配置:

I have a successfully running WCF service that I can call using javascript. However I want to invoke it using the WCF test client and im having difficulty doing this. I am told that I need to make sure I have enabled meta data publishing at the specified address. After reading the documentation I just cant see what im meant to do this is my configuration:

<system.serviceModel>
   <services>
       <service name="CommentSessionIDWCFService" 
                behaviorConfiguration="CommentSessionIDBehavior">
          <endpoint 
              address="" 
              behaviorConfiguration="CountryProvinceBehavior"
              binding="webHttpBinding" 
              contract="ICommentSessionIDWCFService" />
       </service>
   </services>
   <behaviors>
      <serviceBehaviors>
         <behavior name="CommentSessionIDBehavior">
            <serviceMetadata httpGetEnabled="true"/>
            <serviceDebug includeExceptionDetailInFaults="true"/>
         </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
          <behavior name="CountryProvinceBehavior">
              <webHttp/>
          </behavior>
      </endpointBehaviors>
   </behaviors>
</system.serviceModel>

我读过的其他职位,但我看不出什么来填充,我只是不断收到错误。 Q的。

I've read other posts but I can't see what to populate and I just keep getting errors. Q's..

1)我是说得很对,我需要在我的配置配置一个完整的新的服务显示的元数据?

1) Am I right in saying that I need to configure a complete new service in my config to show the metadata?

2)我怎么添加到配置,使发布的,所以我可以与客户端调用这个元数据?

2) What do I add to the configuration to make this meta data published so I can invoke with the client?

推荐答案

您需要为您服务元数据终结,here`s一个例子。

You need a metadata endpoint for your service, here`s an example.

<services>
    <service name="MyService" behaviorConfiguration="MEX">
    <endpoint
        address="http://localhost:8000/MEX"
        binding="mexHttpBinding"
        contract="IMetadataExchange"
    />
    </service>
</services>

<behaviors>
    <serviceBehaviors>
        <behavior name="MEX">
            <serviceMetadata/>
        </behavior>
    </serviceBehaviors>
</behaviors>

这篇关于错误:无法从WCF服务获取元数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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