Сервер не может очистить заголовки после отправки http заголовков
У меня есть веб-сервис .asmx в том же решении с контроллерами API.
Службы asmx были аннулированы функции и возвращение подгонять ответ в формате JSON.
Проблема в том, что я получаю ошибку "сервер не может очистить заголовки после отправки http-заголовков".
Что я уже пробовал:
private void Json(object obj, int httpcode) { string objJson = JsonConvert.SerializeObject(obj); HttpContext.Current.Response.Clear(); HttpContext.Current.Response.StatusCode = httpcode; HttpContext.Current.Response.TrySkipIisCustomErrors = true; HttpContext.Current.Response.ContentType = "application/json; charset=utf-8"; HttpContext.Current.Response.Write(objJson); HttpContext.Current.Response.Flush(); // Gets or sets a value indicating whether to send HTTP content to the client. HttpContext.Current.Response.SuppressContent = true; // Causes ASP.NET to bypass all events and filtering in the HTTP pipeline chain of execution and directly execute the EndRequest event. HttpContext.Current.ApplicationInstance.CompleteRequest(); }
MadMyche
Какая строка выдает ошибку? Вы пробовали перестроить код в отношении "SuppressContent"