views:

37

answers:

2

I'm trying to expose a webHttpBinding EndPoint using Framework 4.0.

<endpoint address="web" binding="webHttpBinding" contract="MyContract"/>

However, when browsing using WFC Test Client, I see nothing. If I change my Framework target to 3.5, it works fine.

Is there something different in 4.0 to get this to work?

A: 

Have a look here:

http://msdn.microsoft.com/en-us/library/w4atty68.aspx

You need to put this

<configuration>
<startup>
<supportedRuntime version="v4.0" />
</startup>
</configuration>
Aliostad
I added this to my server's web.config file. According to IntelliSense, <supportedRuntime> isn't a valid child to <startup>. Added it anyway, but still no joy. Anything else?
Chu
Where did you change it? This needs to go where you are running version 4.0. If it is client, you need to build it against 4.0. What is the error you get? WHat happens if you browse using browser?
Aliostad
I'm running this service in IIS. I added the supportedRuntime to the server's web.config file. The client in this case is the WCF Test Client app... no errors occur, but no endpoint is being exposed. Even if I look at the WDSL with a browser, the endpoint is not shown.
Chu
Perhaps you wanna put "System.ServiceModel" section of the config in there. your snippet is not enough.
Aliostad
A: 

First of all WCF Test Client is for testing SOAP endpoints, it is not able to use REST endpoints (webHttpBinding).

Edit:

.NET 3.5 handled REST services incorrectly and added these endpoints to WSDL. But generated proxies (even in WCF Test Client) usually didn't work because WSDL is not able to describe HTTP Verbs and other REST specific features needed to call operation. .NET 4.0 doesn't include web endpoints to WSDL (and that is the reason why endpoints are not visible in WCF Test client).

Ladislav Mrnka
Are you sure? http://knowledgebaseworld.blogspot.com/2010/06/wcf-service-with-webhttpbinding.html
Chu
Yes I'm sure. Check my edit.
Ladislav Mrnka
Thanks for clarification - with that said, when I expose a basicHttp bind, I can look at the wsdl for the service in a browser and see it in the list. Does the same hold true for webhttpBinding in 4.0, in that I should NOT see the binding as part of the wsdl?
Chu
.NET 4.0 provides special help page for REST services which you can turn on: http://msdn.microsoft.com/en-us/library/ee230442.aspx
Ladislav Mrnka