C# 远程服务器返回错误:(422)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/839820/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 03:38:03  来源:igfitidea点击:

The remote server returned an error: (422)

c#.netwebresponse

提问by Ramesh Soni

I am getting following error when I am trying to get WebResponse using

当我尝试使用 WebResponse 获取 WebResponse 时出现以下错误

WebResponse response = request.GetResponse()

The remote server returned an error: (422).

远程服务器返回错误:(422)。

at System.Net.HttpWebRequest.GetResponse()
   at HopSharp.HoptoadClient.Send(HoptoadNotice notice) in D:\Projects\...dClient.cs:line 65

Does anyone have idea about this exception?

有没有人知道这个例外?

采纳答案by driis

That exception means that the web server responded with an error code, namely 422. You will need to check with the administrator of the remote site, why that might be. (Or look at the body of the response if any was returned, it might include some hints).

该异常意味着 Web 服务器以错误代码响应,即 422。您需要与远程站点的管理员核实,可能是为什么。(或者查看响应的正文,如果有返回,它可能包含一些提示)。

Here is the explanation of error code 422: http://tools.ietf.org/html/rfc4918#section-11.2

以下是错误代码 422 的解释:http: //tools.ietf.org/html/rfc4918#section-11.2

The request you are sending to the server is most likely invalid in some way or another. What the exact error might be, is impossible to tell without knowing which request you are sending against which system.

您发送到服务器的请求很可能以某种方式无效。确切的错误可能是什么,如果不知道您针对哪个系统发送哪个请求,就不可能知道。