In C# I can override WebClient.GetWebRequest method in order to change HTTP version.
prote开发者_高级运维cted override WebRequest GetWebRequest(Uri uri)
{
HttpWebRequest request = (HttpWebRequest)base.GetWebRequest(uri);
request.ProtocolVersion = System.Net.HttpVersion.Version10;
return request;
}
I have to change HTTP request version to 1.0 before invoking web service using New-WebServiceProxy.
Is there a way to change this?
Set the ProtocolVersion field to version10. Like so,
$hr = [system.net.httpwebrequest]::create("http://www.example.com")
$hr.ProtocolVersion = [system.net.httpversion]::version10
Mind you, unlike C#, Powershell (and .Net API bindings) are note case sensitive.
精彩评论