C# HttpWebRequest 请求返回 The remote server returned an error: (400) Bad Request.
可以看下他的响应Body
catch (WebException ex)
{
if (ex.Status == WebExceptionStatus.ProtocolError)
{
HttpWebResponse err = ex.Response as HttpWebResponse;
if (err != null)
{
string htmlResponse = new StreamReader(err.GetResponseStream()).ReadToEnd();
string txtResults = string.Format("{0} {1}", err.StatusDescription, htmlResponse);
return txtResults;
}
}
return ex.Message;
}
C# HttpWebRequest 请求返回 The remote server returned an error: (400) Bad Request.的更多相关文章
- Call Azure Queue get "The remote server returned an error: (400) Bad Request."
这几天开始研究Windows Azure, 在使用Azure Queue 的时候,CreateInfNotExists 总是抛出异常 "The remote server returned ...
- WebService:The remote server returned an error: (400) Bad Request
开发工具:VS2010.开发组件:WebService.运行环境:Windows 今天一个同事在进行计费接口联调试时,发现了一个非常奇怪的问题:接口在家里环境测试,一切正常,但是部署到现网环境之后,连 ...
- System.Net.WebException : The remote server returned an error: (415) UNSUPPORTED MEDIA TYPE
I am having problems with a bit of code that accesses a restful web service. Running this code, it e ...
- EWS code return Error : Request failed. The remote server returned an error: (403) Forbidden OR (401) Unauthorized
Following is my code. ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1 ...
- HttpWebRequest WebExcepton: The remote server returned an error: (407) Proxy Authentication Required.
1. Supply the credentials of the Currently Logged on User to the Proxy object similar to this: // Be ...
- request 报错The remote server returned an error: (415) Unsupported Media Type.
开发时遇到个问题,程序访问数据库数据,给服务器发送请求时,老是报错,返回的错误页面是: HTTP Status 415 - Unsupported Media Type type Status rep ...
- WP8 调用webservice 错误 The remote server returned an error: NotFound 解决
本人出错是由于本地的IIS不能被局域网其它机器访问导致的,如果你所用的本机IIS 也不可被其它机器访问,则可按照本文进行设置 具体操作时需要在防火墙设置中添加 入站规则 具体步骤如下: 1.控 ...
- unity 打包Error:WebException: The remote server returned an error: (403) Forbidden.
記一下在ios上打包出錯: UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors at UnityEditor.BuildPlaye ...
- CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.
今天,在用icinga服务器端测试客户端脚本时,报如下错误: [root@mysql-server1 etc]# /usr/local/icinga/libexec/check_nrpe -H 192 ...
- HttpWebRequest请求返回非200的时候 HttpWebResponse怎么接受返回错误提示
当我们使用HttpWebRequest发送请求的时候如果服务器返回的不是200状态,那么请求代码肯定会异常,其实请求和返回并没有什么异常,只是.net内部就认定了 返回的不要是200 就是异常 那么我 ...
随机推荐
- udl(Universal Data Link)通用数据连接文件
新建文本文档 更改后缀名为.udl(注意小点) 然后打开运行 配置并测试 改回后缀名.txt(有个小点哦) 打开就是了
- android中大咖:TlistView
d的android中的Tlistview相当于cxGrid,其开发使用中的主咖地位至高无上. 可是如何高效使用快速实现的需求呢?需要的话补官方的教程 上图: GOODLUCK!
- RAG, GraphRAG, LightRAG, and KAG
KAG: A Better Alternative to RAG for Domain-Specific Knowledge Applications https://medium.com/@ahme ...
- 使用SymPy求解矩阵微分方程
引言 在数学.物理.工程等领域,微分方程常常被用来描述系统的变化和动态过程.对于多变量系统或者多方程系统,矩阵微分方程是非常常见的,它可以用来描述如电路.控制系统.振动系统等复杂的动态行为.今天,我们 ...
- .net clr 8年才修复的BUG,你让我损失太多了
一.概述 .NET社区修复问题可谓是龟速,一个BUG在.NET 7.0+版本才修复,你让我损失了几万块,我现在还记得客户那种质疑的表情,你了解那种尬尴的气氛吗?你让我一度怀疑dotnetty,我从来不 ...
- JVM 的 TLAB(Thread-Local Allocation Buffer)是什么?
JVM 的 TLAB(Thread-Local Allocation Buffer)是什么? TLAB(Thread-Local Allocation Buffer)简介 TLAB(Thread-Lo ...
- linux文件或目录权限、权限字符转为权限值
1.字符的含义 当ll一个目录时会有类似下面的输出 [root@node2 ~]# ll /usr/ total 112 dr-xr-xr-x. 2 root root 24576 Oct 13 23 ...
- 基于CNN(卷积神经网络)的车牌号识别【结尾附完整项目下载地址】
基于卷积神经网络(CNN)的车牌识别技术是一种深度学习方法,用于自动检测并识别车辆的车牌号码.以下是经过优化后的处理步骤: 图像预处理:首先对获取的车牌图像进行处理,包括将其转换为灰度图.二值化处理以 ...
- 如何将EndNote 和 Word (office)连接起来
1,首先在电脑上打开word2019,点击左上角的"文件"菜单. 2,然后在打开的文件菜单中点击"选项"的快捷链接. 3,接下来在打开的Word选项窗口中点击左 ...
- bootstrap4下拉菜单无法显示问题
刚才在菜鸟教程学习bootstrap4时在按钮组章节中遇到了下拉菜单,可是自己没有调试出来!!! 我把菜鸟的代码copy(全部)到本地发先可以运行!!! 找了半天原因,可能是自己导入的js文件有错!! ...