2009-10-06 8 views
0

J'ai un serveur auto-hébergé (service Windows) qui prend en charge à la fois SOAP/RPC (cela peut disparaître dans le futur) et REST. Les GET RESTful fonctionnent comme prévu, mais PUT/POST donne une erreur 405 (méthode non prise en charge). Je suis à peu près sûr que c'est un problème de configuration avec mon app.config, mais je suis assez nouveau à ce sujet et je ne suis pas sûr de ce qu'il faut essayer.PUT/POST ne fonctionne pas dans la configuration WCF REST auto-hébergée

Voici mon fichier de configuration. Toute aide serait greately apprécié ...

<system.serviceModel> 
    <!-- bindings --> 
    <bindings> 
     <basicHttpBinding> 
     <binding name ="soapBinding"> 
      <security mode="None" /> 
     </binding> 
     </basicHttpBinding> 
     <webHttpBinding> 
     <binding name="webBinding" /> 
     </webHttpBinding> 
    </bindings> 
    <!-- behaviors --> 
    <behaviors> 
     <endpointBehaviors> 
     <!-- plain old XML --> 
     <behavior name="poxBehavior"> 
      <webHttp/> 
     </behavior> 
     <!-- JSON --> 
     <behavior name="jsonBehavior"> 
      <enableWebScript /> 
     </behavior> 
     </endpointBehaviors> 
     <serviceBehaviors> 
     <behavior name="DSServerBehavior"> 
      <serviceMetadata httpGetEnabled="true"/> 
      <serviceDebug includeExceptionDetailInFaults="True"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <!-- services --> 
    <services> 
     <service behaviorConfiguration="DSServerBehavior" name="dsServer.DSServer"> 
     <host> 
      <baseAddresses> 
      <add baseAddress="http://localhost:8000/DecisionSupportServer" /> 
      </baseAddresses> 
     </host> 
     <endpoint address="soap" 
        binding="basicHttpBinding" 
        bindingConfiguration="soapBinding" 
        contract="dsServer.IDSServer" /> 
     <endpoint address="mex" 
        binding="mexHttpBinding" 
        contract="IMetadataExchange" /> 
     <endpoint address="rest" 
        binding="webHttpBinding" 
        bindingConfiguration="webBinding" 
        behaviorConfiguration="poxBehavior" 
        contract="dsServer.IDSServer" /> 
     </service> 
    </services> 
    </system.serviceModel> 
+0

Ack: La configuration XML a été annulée en dehors de la publication Je vais devoir trouver comment l'attacher –

+0

@Allan: il vous suffit de surligner votre XML (ou code) puis de cliquer sur le "code "bouton (010 101) dans la barre d'outils de l'éditeur - ou appuyez sur Ctrl-K sur votre clavier - pour le formater bien –

+0

Ah! Merci pour la fixation du format de poste –

Répondre

0

J'ai vérifié cela en utilisant CURL et fait un petit changement à mon client. C'était une erreur de l'utilisateur. :(