【问题标题】:WCF and IIS 6 - WSDL is not exposedWCF 和 IIS 6 - 未公开 WSDL
【发布时间】:2009-08-04 12:23:30
【问题描述】:

我开发了一个包含 WCF 服务的 ASP.NET 应用程序。此服务需要由第三方应用程序使用。在我的开发环境中进行测试时,该服务运行良好。我的开发环境在 Window 7 RC 1 上使用 IIS 7.0。但是,一旦它在我的登台/生产环境中,我就无法使用该服务。我的暂存/生产环境是 Windows Server 2003、IIS 6 环境。

当我尝试在 IIS 6 环境中引用该服务时,我收到一条错误消息:

错误:无法获取元数据 ...

有趣的是,我在测试暂存/生产环境时注意到了一个微妙但我认为很重要的差异。

在我的测试环境中,我注意到我可以使用以下模板通过 url 访问服务页面:

http://localhost/MyApp/services/myService.svc

我还注意到,在我的测试环境中,如果我访问具有以下模板的 url,我可以看到 WSDL 信息:

http://localhost/MyApp/services/myService.svc?wsdl

但是,在我的登台/生产环境中,我看不到 WSDL 信息。奇怪的是,我可以看到服务页面。

这里是与我的生产环境中的服务相关的配置设置。

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

  <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
  <services>
    <service behaviorConfiguration="myServiceBehavior" name="myService">
      <endpoint address="" binding="basicHttpBinding" contract="myService" />
      <endpoint address="mex" binding="mexHttpBinding" 
        contract="IMetadataExchange" />
    </service>
  </services>
</system.serviceModel>

为什么在 Windows Server 2003 IIS 6.0 环境下我可以看到服务页面而看不到 WSDL 页面?

谢谢!

【问题讨论】:

  • 离线与乍得交谈,他向我保证没有花栗鼠。在配置详细信息到来之前,我暂缓判断。
  • 顺便说一句,我以为我是原创的,但我猜不是:stackoverflow.com/search?q=chipmunks
  • 问题正文中现在提供了配置详细信息。感谢您参加高峰期。

标签: wcf iis iis-6 wsdl


【解决方案1】:

您是否启用了元数据交换?

    <serviceMetadata httpGetEnabled = "true"/>

您是否定义了元数据交换端点

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

【讨论】:

    【解决方案2】:

    要添加到Shiraz's 答案,以下 MSDN 文章详细介绍了发布服务元数据:

    Publishing Metadata Endpoints (MSDN Library)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-04-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多