Last active
August 29, 2015 14:13
-
-
Save sethlivingston/fc7236c59d4f11a4124e to your computer and use it in GitHub Desktop.
Returning a text file from ServiceStack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GET /DocData/api/replication/db.json?DbName=test HTTP/1.1 | |
Host: localhost | |
Connection: keep-alive | |
Cache-Control: max-age=0 | |
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 | |
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36 | |
Accept-Encoding: gzip, deflate, sdch | |
Accept-Language: en-US,en;q=0.8 | |
Cookie: ss-id=hO2XaZXMotKtMOEOE4WF; ss-pid=9MwQlX6VDITl5UcGsLfH; DocStudySetId=7945916; AuthSession= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HTTP/1.1 500 NullReferenceException | |
Cache-Control: private | |
Content-Type: application/json; charset=utf-8 | |
Vary: Accept | |
Server: Microsoft-IIS/7.5 | |
X-Powered-By: ServiceStack/4.035 Win32NT/.NET | |
Access-Control-Allow-Origin: * | |
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS | |
Access-Control-Allow-Headers: Content-Type, Authorization | |
X-AspNet-Version: 4.0.30319 | |
Set-Cookie: AuthSession=; path=/; HttpOnly | |
X-Powered-By: ASP.NET | |
Date: Thu, 15 Jan 2015 16:35:09 GMT | |
Content-Length: 1330 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"ResponseStatus":{ | |
"ErrorCode":"NullReferenceException", | |
"Message":"Object reference not set to an instance of an object.", | |
"StackTrace":"[DocDtoReplication: 1/15/2015 2:44:03 PM]:\n[REQUEST: {DbName:statins}]\nSystem.NullReferenceException: Object reference not set to an instance of an object.\r\n at ServiceStack.HttpResult.get_IsPartialRequest()\r\n at lambda_method(Closure , HttpResult )\r\n at ServiceStack.Text.Common.WriteType`2.WriteProperties(TextWriter writer, Object value)\r\n at ServiceStack.Text.JsonSerializer.SerializeToString(Object value, Type type)\r\n at ServiceStack.Text.JsonSerializer.SerializeToString[T](T value)\r\n at ServiceStack.Serialization.JsonDataContractSerializer.SerializeToString[T](T obj)\r\n at ServiceStack.Host.ContentTypes.SerializeToString(IRequest req, Object response)\r\n at ServiceStack.RequestExtensions.ToOptimizedResult[T](IRequest request, T dto)\r\n at DocDataWebApp.Dre.Config.DocServiceRunner`1.OnAfterExecute(IRequest requestContext, Object response) in c:\\doc\\DocDataWebApp\\Dre\\Config\\DocServiceRunner.cs:line 26\r\n at ServiceStack.Host.ServiceRunner`1.AfterEachRequest(IRequest requestContext, TRequest request, Object response)\r\n at ServiceStack.Host.ServiceRunner`1.Execute(IRequest request, Object instance, TRequest requestDto)", | |
"Errors":[ | |
] | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fileName = String.Concat( @"~/backups/", request.DbName, ".txt" ); | |
var fileInfo = new FileInfo( fileName.MapHostAbsolutePath() ); | |
return new HttpResult( fileInfo, asAttachment: false ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment