Once, to have a complete control over the head/body of HTTP messages - I use the Message class. To return some XML, for example, I call
public Message ShowRunResults()
{
// some [OperationContract] implementation
webContext.CreateTextResponse(result.ToString(), "application/xml", Encoding.ASCII);
}
The question is how to return 404 not found or other HTTP codes? thanks a lot
使用WebOperationContext.Current.OutgoingResponse
,您可以设置HTTP代码和状态。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.