I have wcf service. I tried to generate proxy code and configuration file for client program by svcutil:
svcutil http://localhost/WcfService2/Files.svc
I got valid file with proxy, but didn't get config file. Why? (VS2010 SP1, .NET 4.0, IIS 7.0)
My service contract:
[ServiceContract]
public interface IFiles
{
[OperationContract]
Guid UploadFile(Stream stream);
}
My web config:
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="WebHttpBinding" maxBufferSize="65536" maxBufferPoolSize="524288"
maxReceivedMessageSize="1073741824" transferMode="Streamed" />
</webHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="MyServiceBehavior" name="WcfService2.Files">
<endpoint behaviorConfiguration="WebHttpBehavior" binding="webHttpBinding"
bindingConfiguration="WebHttpBinding" name="Files" contract="WcfService2.IFiles" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="WebHttpBehavior">
<webHttp defaultBodyStyle="Wrapped" defaultOutgoingResponseFormat="Json"
automaticFormatSelectionEnabled="false" />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="MyServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<system.web>
<httpRuntime maxRequestLength="100000" />
</system.web>
</configuration>
Endpoints which use the WebHttpBinding (a.k.a., WCF WebHttp endpoints), do not expose metadata like "normal" (i.e., SOAP) endpoints do. WCF will still generate a WSDL for your service (since you specified <serviceMetadata httpGetEnabled="true"/>
), but the metadata will only contain certain aspects of the service (such as data contracts, etc). The Web-related features (WebInvoke/WebGet attributes) won't be on the proxy, so even though you get a proxy file, you'll likely won't be able to use it to communicate to the service (unless you didn't use any of those). The problem is that there's no widely accepted format for describing metadata for REST services (WADL is possibly the most used, but it's not nearly as prevalent as WSDL for SOAP, and it's not implemented by WCF).
In short: svcutil doesn't really work for web endpoints.
If you want the long version: http://blogs.msdn.com/b/carlosfigueira/archive/2012/03/26/mixing-add-service-reference-and-wcf-web-http-a-k-a-rest-endpoint-does-not-work.aspx