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

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

问题描述

我有一个成功运行的 WCF 服务,我可以使用 javascript 调用它.但是我想使用 WCF 测试客户端调用它,但我很难做到这一点.有人告诉我,我需要确保已在指定地址启用元数据发布.阅读文档后,我只是看不出我的意思是这是我的配置:

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>

我已经阅读了其他帖子,但我看不到要填充的内容,而且我不断收到错误消息.问..

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?

我要在配置中添加什么来发布此元数据,以便我可以与客户端调用?

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

推荐答案

您的服务需要一个元数据端点,这是一个示例.

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天全站免登陆