3

ONVIF認証に完全に行き詰まっています。私はすべて、または少なくともほとんどすべてを試したと思いますが、インターネット上で十分な情報が見つかりません。svcutil を使用してスタブ クライアントを作成しました。認証を行うためのコードは次のとおりです (多くのことを試したので、そのうちの 1 つです)。

 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."}

これを解決するための情報を提供していただければ、非常に感謝しています。

4

2 に答える 2

0

これにはいくつかの原因が考えられます。

  1. Web ブラウザー経由で root パスワードを設定したため、ONVIF ユーザーがロックされました。カメラにログインし、ONVIF ユーザーを追加します (そのための特別なページがあります)

  2. パスワード ダイジェストには、パスワードのみが含まれます。ランダムな nonce、作成時刻、およびパスワードの連結が含まれている必要があります。

  3. ローカルの時計がカメラの時計と同期していません。getSystemDateAndTime を呼び出してリモート クロックを読み取り、2 人の時差を記録します。

これらは、私を遅らせた4つの主要な事柄のうちの3つでした(4番目のものはwsdlのインポートでしたが、すでに取得しているようです)

于 2012-05-03T11:55:18.630 に答える