Sto provando a generare un valore JSONP corretto per jQuery da consumare.Restituisce JSONP nel formato corretto WCF
L'uscita che sto cercando è:
jsoncallback({"Status": "OK"})
Ma l'atm è l'output:
"jsoncallback({"Status": "OK"})"
Evidentemente questo non è nel formato corretto JSONP come la richiesta di jQuery non può gestire il risposta.
mio OperationContract in C# è:
[OperationContract]
[WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Json,
UriTemplate = "returndata?s={s}")]
Stream EchoWithGet(string s);
public string EchoWithGet(string s)
{
string json = @"jsoncallback({'Status':'OK'})";
Console.WriteLine("Call Made: " + s);
return json;
}
Ho provato con JSON.NET
e anche il System.Web.Script
Namespace per utilizzare il JavaScriptSerializer
.
Ma niente funziona per me tutto ciò che in realtà voglio fare è sbarazzarsi di due virgolette doppie.
cosa c'è WPF ha a che fare con questo? –
Sto usando l'ambiente WPF, quindi voglio soddisfarlo.Normalmente finirò per ottenere risposte relative ad ASP dove non sarebbe di aiuto –