我有一個使用響應篩選器將數據驗證消息添加到我們的服務的服務堆服務器。我的Put/Post處理程序返回一個HttpResult對象,並將Response設置爲我們的驗證對象。響應過濾器然後將這個對象分解成一個原始的html字符串,它將Response對象設置爲。爲了得到這個工作,我必須在「視圖」中創建一個String.md文件以及一個空白的html模板文件。我目前看到的問題是,當我們的自定義HTML響應包含一個逗號「」 fromater嘗試序列串並拋出一個異常JSV:如何在響應過濾器中禁用某些請求的jsv格式器?
at System.String.get_Chars(Int32 index)
at ServiceStack.Text.Jsv.JsvTypeSerializer.EatMapKey(String value, Int32& i)
at ServiceStack.Text.Common.DeserializeDictionary`1.ParseStringDictionary(String value)
at ServiceStack.Text.Jsv.JsvReader`1.Parse(String value)
at ServiceStack.Text.TypeSerializer.DeserializeFromString[T](String value)
at ServiceStack.Html.ViewDataDictionary.PopulateModelState()
at ServiceStack.Html.HtmlHelper.Init(IViewEngine viewEngine, ViewDataDictionary viewData)
at ServiceStack.Html.HtmlHelper.Init(MarkdownPage markdownPage, Dictionary`2 scopeArgs, Boolean renderHtml, ViewDataDictionary viewData)
at ServiceStack.Markdown.MarkdownViewBase.Init(IAppHost appHost, MarkdownPage markdownPage, Dictionary`2 scopeArgs, Object model, Boolean renderHtml)
at ServiceStack.WebHost.Endpoints.Support.Markdown.MarkdownPage.Write(TextWriter textWriter, PageContext pageContext)
at ServiceStack.WebHost.Endpoints.Support.Markdown.TemplateExtensions.RenderToString(MarkdownPage markdownPage, Dictionary`2 scopeArgs, Boolean renderHtml)
at ServiceStack.WebHost.Endpoints.Formats.MarkdownFormat.RenderDynamicPage(MarkdownPage markdownPage, Dictionary`2 scopeArgs, Boolean renderHtml, Boolean renderTemplate)
at ServiceStack.WebHost.Endpoints.Formats.MarkdownFormat.RenderDynamicPage(MarkdownPage markdownPage, String pageName, Object model, Boolean renderHtml, Boolean renderTemplate)
at ServiceStack.WebHost.Endpoints.Formats.MarkdownFormat.ProcessMarkdownPage(IHttpRequest httpReq, MarkdownPage markdownPage, Object dto, IHttpResponse httpRes)
at ServiceStack.WebHost.Endpoints.Formats.MarkdownFormat.<Register>b__1(IRequestContext requestContext, Object dto, IHttpResponse httpRes)
at ServiceStack.WebHost.Endpoints.Formats.HtmlFormat.<>c__DisplayClass1.<SerializeToStream>b__0(StreamSerializerResolverDelegate x)
at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
at ServiceStack.WebHost.Endpoints.Formats.HtmlFormat.SerializeToStream(IRequestContext requestContext, Object dto, IHttpResponse httpRes)
at ServiceStack.Common.Web.HttpResponseFilter.SerializeToStream(IRequestContext requestContext, Object response, Stream responseStream) in i:\GitHub\ServiceStack\src\ServiceStack.Common\Web\HttpResponseFilter.cs:line 152
at ServiceStack.Common.Web.HttpResult.WriteTo(Stream responseStream) in i:\GitHub\ServiceStack\src\ServiceStack.Common\Web\HttpResult.cs:line 219
at ServiceStack.WebHost.Endpoints.Extensions.HttpResponseExtensions.WriteToOutputStream(IHttpResponse response, Object result, Byte[] bodyPrefix, Byte[] bodySuffix)
at ServiceStack.WebHost.Endpoints.Extensions.HttpResponseExtensions.WriteToResponse(IHttpResponse response, Object result, ResponseSerializerDelegate defaultAction, IRequestContext serializerCtx, Byte[] bodyPrefix, Byte[] bodySuffix)
我國的問題是如何能夠把JSV關閉這些迴應?還是有更好的方式來返回原始的HTML?我不能讓我的請求處理程序返回一個字符串,因爲我需要控制返回的響應代碼和頭文件。