i VS2010 hedef çerçevesini kullanıyorum CreateTextResponse üzerindeki complining 3.5 hatadır:System.ServiceModel.Web.WebOperationContext.CreateTextResponse hatası
'System.ServiceModel.Web.WebOperationContext' 'CreateTextResponse için bir tanım içermiyor 've hiçbir uzantı yöntemi' System.ServiceModel.Web.WebOperationContext 'türündeki ilk argüman kabul' CreateTextResponse bulunamadı (bir kullanarak yönergesi veya bir derleme başvurusu eksik?) den
[OperationContract]
[WebInvoke(UriTemplate = "", Method = "GET",
BodyStyle=WebMessageBodyStyle.Bare,
ResponseFormat = WebMessageFormat.Json)]
public Message Blah()
{
var j = new { Name = "blah1", Data = "blah2" };
JavaScriptSerializer s = new JavaScriptSerializer();
string jsonClient = s.Serialize(j);
return WebOperationContext.Current.CreateTextResponse("method(" + jsonClient + ");",
"application/json; charset=utf-8", Encoding.UTF8);
}
Alternatif nedir? –
İşte bir alternatif: http://msdn.microsoft.com/en-us/library/cc716898(VS.90).aspx. –
bana bildirebilir misin yoksa response.write yöntemini kullanabilir miyim? –