I am on Mono 3.x, on Mac OSX, and I am trying to return a static file with ServiceStack. The code (and should be, according to other answers) is very simple:
public class AirPlayService : Service
{
public object Get(Movie request)
{
var fileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Movies", request.Name);
var file = new FileInfo(fileName);
return new HttpResult(file, asAttachment:false);
}
}
The Movie object is a simple DTO.
When my Get () is called, I see the following error in the terminal window:
ERROR: Error processing request: [IOException] Write error, exception: write failed INFO: Failed to write error for response: {0}, Exception: cannot be changed after sending headers. ERROR: Error in HttpListenerResponseWrapper: write failed, exception: write failed
ServiceStack - version 3.9.35; Mono JIT compiler version 3.0.3 (master / 39c48d5 Tue 8 Jan 12:12:24 EST 2013) ;. NET 4.5.
What am I doing wrong?
source
share