發現問題:
post請求,在發送一個圖片base64編碼的字符串時,服務端報這個錯誤。
報錯信息中給出了解決辦法:
最可能的原因:
Web 服務器上的請求篩選被配置為拒絕該請求,因為查詢字符串過長。
可嘗試的操作:
確認 applicationhost.config 或 web.config 文件中的 configuration/system.webServer/security/requestFiltering/requestLimits@maxQueryString 設置。
解決問題:
參考了博客:https://www.cnblogs.com/mengtree/p/5255177.html
最后修改了項目中 web.config 配置文件,添加了如下內容。
<system.web> <compilation debug="true" targetFramework="4.5" /> <httpRuntime targetFramework="4.5" maxRequestLength="102400" maxQueryStringLength="102400" /> </system.web> <system.webServer> <security> <requestFiltering> <requestLimits maxAllowedContentLength="2147483647" maxQueryString="2147483647" /> </requestFiltering> </security> </system.webServer>
順利解決問題。