Svcutil does not create a configuration file

I have a wcf service. I tried creating the proxy code and configuration file for the client program using svcutil:

svcutil http://localhost/WcfService2/Files.svc 

I received a valid proxy file but did not receive the configuration file. What for? (VS2010 SP1, .NET 4.0, IIS 7.0)

My service contract:

 [ServiceContract] public interface IFiles { [OperationContract] Guid UploadFile(Stream stream); } 

My web configuration:

 <?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> 
+6
source share
1 answer

Endpoints that use WebHttpBinding Web sites (aka, WCF WebHttp) do not provide metadata, such as β€œnormal” (ie SOAP) endpoints. WCF will still generate WSDL for your service (since you specified <serviceMetadata httpGetEnabled="true"/> ), but metadata will only contain specific aspects of the service (e.g. data transfer contracts, etc.). Web functions (WebInvoke / WebGet attributes) will not be included in the proxy server, so even if you receive a proxy file, you most likely will not be able to use it to communicate with the service (if you did not do this, t use any of them). The problem is that there is no widespread format for describing metadata for REST services (WADL is perhaps most commonly used, but it is not as widespread as WSDL for SOAP, and it is not implemented by WCF).

In short: svcutil really does not work for web endpoints.

If you need a long version: http://blogs.msdn.com/b/carlosfigueira/archive/2012/03/26/mixing-add-service-reference-and-wcf-web-http-aka-rest-endpoint- does-not-work.aspx

+8
source

Source: https://habr.com/ru/post/892329/


All Articles