rest - WCF Proxy Using Post Even Though WebGet Attribute is Specified (Only when called from another WCF service) - Causes 405 Error -


I have the responsibility to obtain a restricted server is HTTP service on another server configured Vebget feature. I know that the service works properly because I can call the browser directly through the service and manually get Get with Fideleller and get a right response.

Calling on which I have a local machine service with the following services:

Proxy Interface 'IProductService':

  System.ServiceModel use; Using System.ServiceModel.Web; Namespace Hugo.Infrastructure.Services.Products {[ServiceContract] [XmlSerializerFormat] public interface IProductService {[OperationContract (name = "GetProductById")] [WebGet (UriTemplate = "Product / title / {id}", ResponseFormat = WebMessageFormat.Xml , RequestFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Bare)] GetTitleById (String ID); }}  

Implementation 'ProductService':

  using System.ServiceModel; Name space Hugo.Infrastructure.Services.Products {public class ProductService: clientbase & lt; IProductService & gt ;, IProductService {Public TitleDto GetTitleById (String ID) {return Channel.GetTitleById (ID); }}}  

Related Web.config section:

  & lt; System.serviceModel & gt; & Lt; Service Hosting Environment aspNetCompatibilityEnabled = "true" & gt; & Lt; BaseAddressPrefixFilters & gt; & Lt; / BaseAddressPrefixFilters & gt; & Lt; / ServiceHostingEnvironment & gt; ... & lt; Client & gt; & Lt; endpoint address = "http: //server/directory/product.svc" bindingConfiguration = "ProductServiceBinding" binding = "WebHttpBinding" behaviorConfiguration = "productService" contract = "Project.Infrastructure.Services.Products.IProductService" name = "ProductServiceRest" / & Gt; & Lt; / Customer & gt; & Lt; Behavior & gt; ... and lieutenant endpiviers & gt; & Lt; Transaction name = "product service" & gt; & Lt; WebHttp / & gt; & Lt; / Behavior & gt; ... & lt; / EndpointBehaviors & gt; & Lt; / Behavior & gt; & Lt; /system.serviceModel>  

This works fine when calling the method from a page within the project, however it makes a mistake on this line return channel; GettitleIID; that when we see the same project calls from within a WCF service error received by us not allow an HTTP 405 "Method" error when IIS logs on the remote server, so we'll see The product service proxy is requesting an HTTP GET, when the method is started from the call page, but when the method is called from the WCF service, it is requesting an HTTP post. Post method is not configured on the service, thus error 405.

Even if even when Page and service in the same folder and namespace we get the same error with the service we are using a classic Asmaks soap service a GET Called and performs the service and responds correctly. We automatically get the WCF service using the System.Net.WebRequest object, the service call succeeds.

The bottom line, WCF tries to use a proxy for posting instead of a GET when used within any other WCF rest service, but if used properly or from a page Works.

Please help!

This can work:


Comments