我在本地机器上创建了 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 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/