sowohl der HTTP-Accept und Content-Type-Header "application/xml" in C#

Ich erstellte eine web-service (REST) in C#. Jetzt möchte ich, dass, wenn jemand nutzt es, sollte es wieder JSON oder XML als pro-Header. Ich fand eine sehr gute tutorial hier. Ich folgte ihm, aber ich weiß nicht, wo es heißt set both the HTTP Accept and Content-Type headers to "application/xml" rufe ich es auf diese Weise http://localhost:38477/social/name. Ich kann die Antwort auf jede Frage, falls meine Frage ist nicht ganz klar, Sie
Dank
Das ist mein code

[WebInvoke(UriTemplate = "{Name}", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Xml)]
        public MyclassData Get(string Name)
        {
            //Code to implement
            return value;

        }
  • Sind Sie bereits mit der WebInvoke & WebGet-Attribut in das rest-service, diese beiden Attribute haben Eigenschaften, um RequestFormat & ResponseFormat
  • Danke,@Mischa hat darauf hingewiesen, die gleiche Sache, aber es funktioniert nicht
  • Bitte copy/paste den code hier ein, so können wir dir weiter helfen
  • Ich habe aktualisiert
InformationsquelleAutor user1391118 | 2012-07-08
Schreibe einen Kommentar