错误响应的 Web API 包括堆栈跟踪和内部异常。出于安全原因,我们希望从错误响应中删除堆栈跟踪。
我可以知道如何进行这些配置吗?
这是现有的示例错误响应:
{
"error":{
"code":"","message":"Resource not found for the segment '***_experienceses'.",
"innererror":{
"message":"Resource not found for the segment '***_experienceses'.",
"type":"Microsoft.OData.Core.UriParser.ODataUnrecognizedPathException",
"stacktrace":"at Microsoft.OData.Core.UriParser.Parsers.ODataPathParser.ParsePath(ICollection`1 segments)\r\n at Microsoft.OData.Core.UriParser.Parsers.ODataPathFactory.BindPath(ICollection`1 segments, ODataUriParserConfiguration configuration)\r\n at Microsoft.OData.Core.UriParser.ODataUriParser.Initialize()\r\n at System.Web.OData.Routing.DefaultODataPathHandler.Parse(IEdmModel model, String serviceRoot, String odataPath, ODataUriResolverSetttings resolverSettings, Boolean enableUriTemplateParsing)\r\n at System.Web.OData.Routing.DefaultODataPathHandler.Parse(IEdmModel model, String serviceRoot, String odataPath)\r\n at Microsoft.Crm.Extensibility.OData.CrmODataPathHandler.Parse(IEdmModel model, String serviceRoot, String odataPath)"
}
}
}
我们希望成为这样:
{
"error":{
"code":"","message":"Resource not found for the segment '***_experienceses'."
}
}