【问题标题】:how to configure wcf endpoints?如何配置 wcf 端点?
【发布时间】:2012-05-30 18:42:51
【问题描述】:
 <system.serviceModel>
    <services>
      <service
          name="myClass.IService1"  behaviorConfiguration="myService">
        <endpoint
          name="ep1"
          address="http://localhost:57582/Service1.svc"
          contract="IService1"
          binding="basicHttpBinding"
          />
        <endpoint 
             address="mex"
             binding="mexHttpBinding"
             contract="IMetadataExchange" />
      </service>
    </services>

    <behaviors>
      <serviceBehaviors>
        <behavior name="myService">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>

但我仍然收到以下错误:: 添加服务失败。服务元数据可能无法访问。确保您的服务正在运行并公开元数据。

【问题讨论】:

  • 我猜该服务可能没有运行
  • 如何确定它是否正在运行?

标签: wcf wcf-client


【解决方案1】:
  1. 您的服务名称IService1 - 这看起来实际上可能是 合同。如果您使用的是普通模板,请删除 I 来自IService1

  2. 如果您是 IIS 主机,您可以删除 address,因为 .svc 文件的位置自动是地址。

  3. 合约需要完全限定,包括合约接口的命名空间

有了这个,你的元数据应该从&lt;.svc file location&gt;?wsdl提供

【讨论】:

  • ...谢谢曼...它的工作。我把合同名称和服务名称弄混了。现在修复了。
猜你喜欢
  • 2013-05-29
  • 1970-01-01
  • 2012-05-16
  • 1970-01-01
  • 2011-09-19
  • 1970-01-01
  • 2012-02-07
  • 1970-01-01
相关资源
最近更新 更多