我有一个在本地 IIS7 上运行的 asp.net mvc 3 应用程序。这引用了一个运行良好的 WCF 服务。
我最近添加了对托管在同一个地方的另一个服务的引用,并且在调用方法时出现以下错误:
The requested upgrade is not supported by 'net.tcp://webdev02:15001/CommonService/Service.svc/mex'. This could be due to mismatched bindings (for example security enabled on the client and not on the server).
服务的 web.config 在第一个工作服务和第二个非工作服务的绑定(bind)之间具有相同的设置。我的客户也有同样的故事。
我还使用我的 Windows 凭据进行连接,如下所示:
svc.ClientCredentials.Windows.ClientCredential.UserName = "myname";
svc.ClientCredentials.Windows.ClientCredential.Password = "mypass";
此外,我可以使用 WcfTestClient 成功调用这两个服务。关于为什么有人不为我工作有什么想法吗?预先感谢您的帮助。
最佳答案
所以一切都按应有的方式配置。当我在客户端的服务实例化期间在端点上设置我的 URL 时出现问题,我在末尾包含了 /mex
,如下所示:
net.tcp://webdev02:15001/CommonService/Service.svc/mex
实际上我的 URL 应该是:
net.tcp://webdev02:15001/CommonService/Service.svc
现在我切断了 /mex
一切正常。
关于c# - 如何修复 WCF "Requested Upgrade is not supported by net.tcp"错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7889465/