【发布时间】:2015-02-26 19:38:00
【问题描述】:
我完全被 ONVIF 身份验证所困扰。我想我什么都试过了,或者至少几乎什么都试过了,但我在互联网上找不到足够的信息。我已经使用 svcutil 创建了存根客户端,我进行身份验证的代码是(其中之一,因为我尝试了很多东西):
string uri = "http://140.0.22.39/onvif/services";
EndpointAddress serviceAddressPrueba = new EndpointAddress(uri);
HttpTransportBindingElement httpBinding = new HttpTransportBindingElement();
httpBinding.AuthenticationScheme = AuthenticationSchemes.Digest;
var messegeElement = new TextMessageEncodingBindingElement();
messegeElement.MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None);
CustomBinding bindprueba = new CustomBinding(messegeElement, httpBinding);
DeviceClient clientprueba = new DeviceClient(bindprueba, serviceAddressPrueba);
string passwordDigestBase64;
//HERE I PUT THE CODE TO ENCRYPT THE PASSWORD.
PasswordDigestBehavior behavior1 = new PasswordDigestBehavior("root",passwordDigestBase64);
clientprueba.Endpoint.Behaviors.Add(behavior1);
string d1;
string d2;
string d3;
string d4;
clientprueba.GetDeviceInformation(out d1, out d2, out d3, out d4);
之后出现如下错误:
{"The remote server returned an unexpected response: (400) Bad Request."}
如果你能帮助我解决这个问题,我将非常非常感激。
【问题讨论】:
标签: c# authentication onvif