我在使用服务堆栈后端简单调用主干集合提取时遇到问题。
返回的响应看起来像一个json,但只是一个原始字符串,而主干不会获取该集合。
我注意到fetch调用总是会导致错误,这很奇怪,因为同一URL的curl请求让我检查一切都很好并且我恢复了200 OK代码。
已编辑:添加了完整的回复
调用curl和收到的输出
回复的标题
> GET /tickets?format=json HTTP/1.1
> User-Agent: curl/7.25.0 (i386-pc-win32) libcurl/7.25.0 zlib/1.2.5
> Host: 192.168.1.50
> Accept: */*
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Date: Tue, 19 Jun 2012 13:09:35 GMT
< Server: Mono.WebServer.XSP/2.8.0.0 Win32NT
< X-AspNet-Version: 4.0.30319
< X-Powered-By: ServiceStack/3,69 Win32NT/.NET
< Set-Cookie: ss-id=URB3Ss34BE2FBliYDXEpBQ==; path=/
< Set-Cookie: ss-pid=HAfI68bmXU6jRdTiH0WEBA==; expires=Sat, 19-Jun-2032 13:06:26
GMT; path=/
< Cache-Control: private, no-cache="Set-Cookie"
< Content-Type: application/json; charset=utf-8
< Content-Length: 459
< Keep-Alive: timeout=15, max=100
* HTTP/1.0 connection set to keep alive!
< Connection: Keep-Alive
json收到原始字符串
[{"id":1,"urgencia":"Normal","fecha":"\/Date(-62135580600000- 0430)\/","ultimaActualizacion":"\/Date(-62135580600000-0430)\/","titulo":"Error 101","descripcion":"Al encender el equipo retorna error 101","status":"A","causas":[],"adjuntos":[],"operadores":[],"citas":[],"estados":[],"comentarios":[{"id":1,"fecha":"\/Date(-62135580600000-0430)\/","editado":"\/Date(-62135580600000-0430)\/","descripcion":"este es un comentario","status":" ","comentarios":[]}]}]
那么如何在服务堆栈中设置头文件,以便主干集合理解这是一个json响应?
更新:我认为我已经找到问题的根源,它与我的Nhibernate模型有关,因为我不能直接将它们用于Rest服务,任何其他模型都会解析为正确的类型。但我仍然不知道为什么。会看看这个。
感谢您的帮助。