How do I fix WCF "Requested Upgrade is not supported by net.tcp" error?

IronicMuffin picture IronicMuffin · Oct 25, 2011 · Viewed 10.9k times · Source

I have an asp.net mvc 3 application running on my local IIS7. This has a reference to a WCF service that works great.

I recently added a reference to another service hosted in the same place, and I get the following error when a method is invoked:

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).

The web.config at the service has identical settings between the bindings for the first working service and the second non-working service. Same story at my client.

I'm also using my windows credentials to connect, like so:

svc.ClientCredentials.Windows.ClientCredential.UserName = "myname";
svc.ClientCredentials.Windows.ClientCredential.Password = "mypass";

Also, I can call both services successfully using the WcfTestClient. Any thoughts as to why one would not be working for me? Thanks in advance for your help.

Answer

IronicMuffin picture IronicMuffin · Oct 26, 2011

So everything is configured as it should be. The problem occurred when I set my URL on the endpoint during the service instantiation on the client, I included the /mex at the end, like so:

net.tcp://webdev02:15001/CommonService/Service.svc/mex

When in fact my URL should have been:

net.tcp://webdev02:15001/CommonService/Service.svc

Everything works great now that I chopped off the /mex.