WCF - IIS 6 与 IIS 7

标签 wcf iis-7 iis-6

我在本地机器上创建了 WCF 服务。我的本地机器使用 Windows 7 RC1,因此 Web 服务器是 IIS 7。但是,我的生产机器是使用 IIS 6 的 Windows Server 2003。

当我尝试在本地环境中引用该服务时,一切正常。但是,当我将我的服务推广到我的生产机器并尝试引用该服务时,我收到一个错误。错误说:

Error: Cannot obtain Metadata from http://www.thedomain.com/theService.svc?wsdl

If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.

WS-Metadata Exchange Error URI: http://www.thedomain.com/theService.svc?wsdl

Metadata contains a reference that cannot be resolved: 'http://www.thedomain.com/theService.svc?wsdl'.

Content Type application/soap+xml; charset=utf-8 was not supported by service http://www.mydomain.com/myService.svc?wsdl. The client and service bindings may be mismatched.

The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'..



我需要在 IIS 6 中做些什么才能让 WCF 服务正常工作吗?我真的很困惑为什么它在本地运行良好,但在生产中却不行。

谢谢!

最佳答案

我能想到的有4种可能:

  • 某些阻止访问该服务的安全设置。检查您的 IIS 日志以获取拒绝访问
  • 服务 web.config 的配置尚未转移到生产
  • 该元数据交换未配置 http get allowed
  • 您正在使用 IIS 6 不支持的较新绑定(bind)

  • IIS 6 支持的绑定(bind)是 basicHttpBinding 和 wsHttpBinding。看:

    http://msdn.microsoft.com/en-us/library/cc949086.aspx

    希望这可以帮助

    关于WCF - IIS 6 与 IIS 7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1222213/

    相关文章:

    c# - 事件驱动异步 WCF 服务调用中的异常处理

    c# - 维护来自 android 的 WCF web 服务调用之间的状态

    java - C# 和 Java Web 服务集成

    iis-7 - 如何在 Windows 7/IIS 7 上部署 WCF 工作流服务应用程序

    tomcat - iis6前端tomcat最常见的方式是什么

    localization - asp 和 iis 6.0 从哪里得到它的日期格式

    windows-7 - 在 IIS6 上测试网站设置

    java - 从 Java 调用 WCF 服务的技术

    iis-7 - 如何托管 wcf 服务?

    asp.net - 编译 debug = true -- 更改而不重新编译?