简体   繁体   English

WCF测试客户端-无法获取元数据

[英]WCF test client - Cannot obtain Metadata

I have a problem with wcf in c#. 我在C#中的wcf有问题。 I get the error message: "Cannot obtain metadata". 我收到错误消息:“无法获取元数据”。 I have tried to google and check for similar posts here, but I can't seem to find out whats wrong. 我曾尝试在Google上搜索并在此处检查类似的帖子,但似乎无法找出问题所在。 Here is my App.config-file: 这是我的App.config文件:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
    <behaviors>
        <serviceBehaviors>
            <behavior name="SearchService.PersonServiceBehavior">
                <serviceMetadata httpGetEnabled="true" />
                <serviceDebug includeExceptionDetailInFaults="false" />
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <services>
        <service behaviorConfiguration="SearchService.PersonServiceBehavior"
            name="SearchService.PersonService">
            <endpoint address="" binding="basicHttpBinding" bindingConfiguration="" contract="SearchService.IPersonService">
                <identity>
                    <dns value="localhost" />
                </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
            <host>
                <baseAddresses>
                    <add baseAddress="http://localhost:8731/Design_Time_Addresses/SearchService/PersonService/" />
                </baseAddresses>
            </host>
        </service>
    </services>
</system.serviceModel>

I will be very happy if anyone can find a fix or guide me in the right direction : ) 如果有人可以找到解决方法或向正确的方向指导我,我将非常高兴:)

I had similar problems a while ago, looking at my config file the only difference I can see is that I am using WebBehavior (please see below) 不久前我遇到类似的问题,查看我的配置文件,我唯一看到的区别是我正在使用WebBehavior(请参见下文)

<system.serviceModel>
<services>
  <service behaviorConfiguration="ServiceBehaviour" name="MyCRMServiceHost.MyCRMService">
    <endpoint address="/imo" behaviorConfiguration="webBehavior"
      binding="webHttpBinding" name="IMOEndpoint" contract="MyCRMServiceHost.IGenerateIMO" />
    <endpoint address="mex" binding="mexHttpBinding" name="MEXEndpoint"
      contract="IMetadataExchange" />
  </service>
</services>
<behaviors>
  <endpointBehaviors>
    <behavior name="webBehavior">
      <webHttp />
    </behavior>
  </endpointBehaviors>
  <serviceBehaviors>
    <behavior name="ServiceBehaviour">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>

</system.serviceModel>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM