c# - 如何修复 WCF "Requested Upgrade is not supported by net.tcp"错误?

标签 c# .net wcf exception net.tcp

我有一个在本地 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/

相关文章:

c# - DirectoryCatalog 和 AssemblyCatalog 之间的区别

c# - 对象序列化: selecting individual properties

c# - 将许多矩形组合成更少的矩形

.net - 安装后如何自动启动服务?

c# - 打开表单时出现 ShowDialog 问题

c# - 为什么 double.NaN 不等于它自己?

javascript - 如何将图表与mvc中的相应数据一起动态导出到excel工作表

c++ - gSOAP 到 WCF。应用程序/soap+xml;字符集=utf-8

javascript - .Net Core 2 在 View 中将 C# 变量转换为 Javascript

c# - Python 中 C# 的 GetBytes() 等价于什么?