mardi 18 août 2015

How do you set the protocol version on a web service

I am getting the same error described in this question... Unable to read data from the transport connection: The connection was closed error in console application

However, I don't know how to set the protocolVersion on the webservice... I am doing this:

        var httpRequestProperty = new HttpRequestMessageProperty();
        httpRequestProperty.Headers[HttpRequestHeader.Authorization] = "Basic " + Convert.ToBase64String(Encoding.ASCII.GetBytes(_service.ClientCredentials.UserName.UserName + ":" + _service.ClientCredentials.UserName.Password));
        httpRequestProperty.Headers[HttpRequestHeader.KeepAlive] = "false";

        var context = new OperationContext(_service.InnerChannel);
        using (new OperationContextScope(context))
        {
                    context.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty;
            return _service.GenericSoapOperation(request);
        }

As you can see, I am setting the keep alive portion but I cannot figure out how to set the protocol version. I can connect from other client machines but not from my developer box. I was able to connect prior to running about a years worth of windows updates.




Aucun commentaire:

Enregistrer un commentaire