我有一个简单的Webserivce(WCF)托管在Windows服务(Selfhost)中。该服务的声明看起来是这样的:代理的生成在一个环境中正常工作,但在另一个环境中却不正常?
<service behaviorConfiguration="MyApp.ServiceImplementation.MyAppIntegration_Behavior" name="MyApp.ServiceImplementation.MyAppIntegration">
<endpoint binding="basicHttpBinding" bindingConfiguration="BasicMyAppIntegration" bindingNamespace="MyApp.ServiceImplementation" contract="MyApp.ServiceContracts.IMyAppIntegration"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8008/MyAppServiceutv/Integration"/>
</baseAddresses>
</host>
</service>
我可以用这个URL眉毛WSDL:
http://localhost:8008/MyAppServiceutv/Integration?wsdl
当添加在Visual Studio 2012中的服务引用我得到这个异常:
例外
该文件被理解,但它无法处理。
- WSDL文档包含无法解析的链接。
- 下载“
http://localhost:8008/MyAppServiceutv/Integration?xsd=xsd0
”时出错。 - 无法连接到远程服务器
元数据包含无法解析的引用:“http://MyComputer:8008/MyAppServiceutv/Integration?wsdl
”。 内容类型application/soap + xml; charset = utf-8不支持服务http://MyComputer:8008/MyAppServiceutv/Integration?wsdl
。客户端和服务绑定可能不匹配。 远程服务器返回错误:(415)由于内容类型'application/soap + xml; charset = utf-8'不是预期的类型'text/xml; charset = utf-8'.. 如果服务在当前解决方案中定义,请尝试构建解决方案并再次添加服务引用。
移动到开发环境
当移动服务的开发电脑一切正常,好了?为什么我只能在一个环境中得到上述问题?这可能是由于强大的安全限制吗?
服务是否在Cassini中运行?如果是这样,它不能从另一台机器调用,您需要将其发布到iis –
否该服务作为Windows服务自动托管。在开发计算机上生成代理没有任何问题,但是在将它全部移到这个更安全的环境中时,它是不可行的? – Banshee
端口8008被配置为接受流量吗?您可能需要使用VS.NET 2010命令提示符中的此命令,如下所示:netsh http add urlacl url = http:// +:8008/user = \ everyone。 – Rajesh