J'ai un service WCF qui fonctionne principalement avec GET mais un contrat doit fonctionner avec POST. Je ne peux pas le faire fonctionner - il renvoie "405 Méthode non autorisée" tout le temps.Utilisation de WCF REST avec POST
Le service doit recevoir JSON et renvoyer un JSON.
Je suppose que c'est quelque chose avec la configuration. Voici mon fichier web.config:
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
<standardEndpoints>
<webHttpEndpoint>
<standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="false" defaultOutgoingResponseFormat="Json" />
</webHttpEndpoint>
</standardEndpoints>
et le service lui-même
[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "LoginUser", BodyStyle=WebMessageBodyStyle.WrappedRequest, ResponseFormat = WebMessageFormat.Json, RequestFormat=WebMessageFormat.Json)]
public int Login(string user, string password)
{ .... }
Toutes les idées? L'aide serait très appréciée!
double possible de http://stackoverflow.com/questions/911859/wcf-rest-post-xml-the-remote-server-returned-an-error-400-bad- demande et http://stackoverflow.com/questions/41155/wcf-service-returning-method-not-allowed – SRM
malheureusement ce n'est pas un doublon :) – Roman