Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/273.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
更改HttpWebRequest(C#)的HTTP版本_C#_Http_Rest_Httpwebrequest - Fatal编程技术网

更改HttpWebRequest(C#)的HTTP版本

更改HttpWebRequest(C#)的HTTP版本,c#,http,rest,httpwebrequest,C#,Http,Rest,Httpwebrequest,我理解这可能是一个非常基本的问题 WindowsAzure需要我使用HTTP1.1调用他们的RESTAPI方法。但是,当我调用我的方法时,我从它们那里得到以下响应: <?xml version="1.0" encoding="utf-8"?><Error><Code>UnsupportedHttpVersion</Code> <Message>The HTTP version specified is not supported for

我理解这可能是一个非常基本的问题

WindowsAzure需要我使用
HTTP1.1
调用他们的RESTAPI方法。但是,当我调用我的方法时,我从它们那里得到以下响应:

<?xml version="1.0" encoding="utf-8"?><Error><Code>UnsupportedHttpVersion</Code>
<Message>The HTTP version specified is not supported for this operation by the server.
RequestId:7cc39976-f022-4f15-b2a3-733fea600b95 Time:2012-01-12T05:52:44.1107398Z</Message>
<Version>1.0</Version><Via /></Error>
这是C#,因此我使用的对象是一个
HttpWebRequest
。我试着在中的标题下查找,但没有找到任何有价值的信息


谁能给我指一下灯吗:)

版本的HTTP不是HTTP头。要为
HttpWebRequest
设置HTTP版本,请使用
HttpWebRequest.ProtocolVersion
属性


有关MSDN中读取的说明和示例代码:

@matt,但根据MSDN的默认值
ProtocolVersion
是HTTP1.1,您与Windows Azure的问题可能是另一个问题。