servicestack 即使已禁用DebugMode和WriteErrorStoreResponse,响应也包括stacktrace,servicestack,servicestack" /> servicestack 即使已禁用DebugMode和WriteErrorStoreResponse,响应也包括stacktrace,servicestack,servicestack" />

servicestack 即使已禁用DebugMode和WriteErrorStoreResponse,响应也包括stacktrace

servicestack 即使已禁用DebugMode和WriteErrorStoreResponse,响应也包括stacktrace,servicestack,servicestack,我正在最新版本的ServiceStack(5.6.0)上运行自托管API 我在请求处理管道的早期努力处理异常。更具体地说,当请求包含|字符时。API将始终返回带有stackTrace的完整错误响应。即使是在禁用了DebugMode和writeErrorStoreResponse的发布版本中 通常情况下,我没有问题,因为大多数问题都是通过自定义错误响应DTO在自定义ServiceRunner中处理的。但此错误发生在调用ServiceRunner之前 如何禁用stackTrace?是否可以用自定义响

我正在最新版本的ServiceStack(5.6.0)上运行自托管API

我在请求处理管道的早期努力处理异常。更具体地说,当请求包含
|
字符时。API将始终返回带有stackTrace的完整错误响应。即使是在禁用了
DebugMode
writeErrorStoreResponse
的发布版本中

通常情况下,我没有问题,因为大多数问题都是通过自定义错误响应DTO在自定义ServiceRunner中处理的。但此错误发生在调用ServiceRunner之前

如何禁用stackTrace?是否可以用自定义响应替换错误响应

这是我在点击时将收到的响应对象,例如
http://localhost:80/*|?

{
    "responseStatus": {
        "errorCode": "ArgumentException",
        "message": "Illegal characters in path.",
        "stackTrace": "   at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)\r\n   at System.IO.Path.InternalCombine(String path1, String path2)\r\n   at System.IO.FileSystemEnumerableIterator`1.GetFullSearchString(String fullPath, String searchPattern)\r\n   at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)\r\n   at System.IO.DirectoryInfo.InternalGetFiles(String searchPattern, SearchOption searchOption)\r\n   at ServiceStack.VirtualPath.FileSystemVirtualDirectory.GetFileFromBackingDirectoryOrDefault(String fName)\r\n   at ServiceStack.VirtualPath.AbstractVirtualPathProviderBase.GetFile(String virtualPath)\r\n   at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()\r\n   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)\r\n   at ServiceStack.Host.HttpListener.ListenerRequest.GetFile()\r\n   at ServiceStack.Host.HttpListener.ListenerRequest.get_IsFile()\r\n   at ServiceStack.HttpHandlerFactory.GetHandlerForPathInfo(IHttpRequest httpReq, String filePath)\r\n   at ServiceStack.HttpHandlerFactory.GetHandler(IHttpRequest httpReq)\r\n   at ServiceStack.AppHostHttpListenerBase.<ProcessRequestAsync>d__8.MoveNext()",
        "errors": null,
        "meta": null
    }
}
{
“反应状态”:{
“错误代码”:“ArgumentException”,
“消息”:“路径中的非法字符。”,
“stackTrace”:“在System.IO.Path.CheckInvalidPathChars(字符串路径,布尔检查附加)\r\n在System.IO.Path.InternalCombine(字符串路径1,字符串路径2)\r\n在System.IO.FileSystemMemerableTerator`1.GetFullSearchString(字符串完整路径,字符串搜索模式)\r\n在System.IO.FileSystemMemerableTerator`1(字符串路径,字符串原始路径,字符串搜索模式,搜索选项搜索选项,搜索结果文件夹`1 resultHandler,Boolean checkHost)\r\n位于System.IO.DirectoryInfo.InternalGetFiles(字符串搜索模式,搜索选项搜索选项)\r\n位于ServiceStack.VirtualPath.FileSystemVirtualDirectory.GetFileFromBackingDirectoryOrDefault(字符串fName)\r\n位于ServiceStack.VirtualPath.AbstractVirtualPath ProviderBase.GetFile(字符串VirtualPath)\r\n位于System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()\r\n位于System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source,Func`2谓词)r\n位于ServiceStack.Host.HttpListener.ListenerRequest.GetFile()\r\n位于ServiceStack.Host.HttpListener.ListenerRequest.get\u IsFile()\r\n位于ServiceStack.HttpHandlerFactory.GetHandlerForPathInfo(IHttpRequest httpReq,字符串文件路径)\r\n位于ServiceStack.HttpHandlerFactory.GetHandler(IHttpRequest httpReq)\r\n位于ServiceStack.AppHostHttpListenerBase.d\u 8.MoveNext(),
“错误”:空,
“meta”:空
}
}

现在应该解决这个问题,当
Config.DebugMode=false
时,它将不再显示HTTP侦听器异常的堆栈跟踪

此更改可从现在的v5.6.1+中获得