produces text html,Returning HTML using Produces("text/html") causes 406 response

I ran into this issue today after upgrading from 1.1 to 2.0. In my particular scenario my API is a 'Gateway' for a number of microservices. In a number of instances after receiving a response from the downstream microservice the controllers were returning this response using a StatusCodeResult, retaining the status code from the result of the call to the downstream services.

After upgrading to 2.0 I found that any response from a downstream service which contained JSON was now being wrapped in additional quotes when being returned to the client of the gateway API, producing invalid JSON as the end result. I assume this is a result of the Json output formatter now being applied to this in 2.0 and being unable to deserialize the content correctly, whereas in 1.x the StringOutputFormatter would have been applied.

For now I have used the workaround that was suggested and this is working fine. I would like to move to returning ContentResult, but at present it seems this always produces a 200 result. The ability to provide a status code when creating a ContentResult using Content() has been mentioned in this thread, that would be a great help.

SQL Prompt是Red Gate Software公司开发的一款强大的SQL代码编辑和优化工具,主要面向数据库开发者和管理员。版本11.0.1.16766是一个更新版本,它提供了更高效、更便捷的SQL编写环境,旨在提升SQL代码的可读性、效率和一致性。这个安装包包含了所有必要的组件,用于在用户的计算机上安装SQL Prompt工具。 SQL Prompt的核心功能包括自动完成、智能提示、格式化和重构。自动完成功能能够帮助用户快速输入SQL语句,减少键入错误;智能提示则基于上下文提供可能的选项,加快编写速度;格式化功能允许用户按照自定义或预设的编码规范对SQL代码进行美化,提升代码的可读性;而重构工具则可以帮助用户优化代码结构,消除潜在问题。 在描述中提到的“代码格式化规则来源于网络”,指的是用户可以通过下载网络上的json文件来扩展或定制SQL Prompt的代码格式化规则。这些json文件包含了特定的格式设置,如缩进风格、空格使用、注释位置等。将这些文件复制到指定的目录(例如:C:\Users\用户名\AppData\Local\Red Gate\SQL Prompt 10\Styles)后,SQL Prompt会读取这些规则并应用到代码格式化过程中,使得用户可以根据个人偏好或团队规范调整代码样式。 以下几点请注意: 1. 经实测,此版本支持最新的Sql Server 2022版的SSMS21 2. 此安装包中不包括keygen,请自行解决
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值