IronicMuffin
IronicMuffin

Reputation: 4202

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

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.

Upvotes: 4

Views: 12583

Answers (2)

IronicMuffin
IronicMuffin

Reputation: 4202

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.

Upvotes: 7

Wesley Long
Wesley Long

Reputation: 1708

The mex is the metadata, and (typically) doesn't require credentials to view. I would start by looking at your service endpoint settings for the metadata (mex) exchange.

I haven't done WCF on net.tcp, but here's an example from my HTTP WCF App:

   <endpoint
      address=""
      binding="wsHttpBinding"
      bindingConfiguration="RequestUserName"
      contract="MyService.IContract"/> 
   <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
  </service>

I can view the wsdl without credentials with the binding set to mexHttpBinding, while the methods are protected by having wsHttpBinding set to:

 <wsHttpBinding>
    <binding name="RequestUserName">
        <security mode="Message">
        <message clientCredentialType="UserName" />
        <transport clientCredentialType="None" proxyCredentialType="None" />
      </security>
    </binding>
  </wsHttpBinding>

Again, I don't have direct experience with net.tcp WCF, but I believe your binding on IMetadataExchange is where to start looking.

Upvotes: 0

Related Questions