- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试与 ONVIF 摄像头建立通信,但由于缺乏 Web 服务、ONVIF 和 C# 方面的经验,我遇到了一些我无法完全理解的奇怪错误。我在 .NET 4.0 上并使用 Visual Studios 2010
EndpointAddress endPointAddress = new EndpointAddress("http://192.168.3.246:80/onvif/device_service");
WSHttpBinding bind = new WSHttpBinding();
bind.Security.Mode = SecurityMode.Message;
bind.Security.Message.ClientCredentialType = MessageCredentialType.UserName;
DeviceClient temp = new DeviceClient(bind, endPointAddress);
temp.ClientCredentials.UserName.UserName = myusername;
temp.ClientCredentials.UserName.Password = mypassword;
SystemDateTime s = temp.GetSystemDateAndTime();
这会导致崩溃并出现错误“元素‘a:Action’中的数据必须被理解但无法处理”。我尝试手动捕获请求并在关闭 "s:mustUnderstand="1
"标志的情况下执行它,但随后我得到一个“Method 't:RequestSecurityToken
' not implemented: method name or namespace not recognized"错误。
我的 ONVIF
相机有问题,还是我做错了什么?自 3 天以来,我一直在尝试各种方法来尝试连接到该相机,而不是像 GetSystemDateAndTime
() 和 GetDeviceInformation
() 这样的简单、不安全的信息,但我我卡住了。
最佳答案
好吧,我希望它最终能帮助其他像我一样陷入困境的人:
HttpTransportBindingElement httpBinding = new HttpTransportBindingElement();
httpBinding.AuthenticationScheme = AuthenticationSchemes.Digest;
var messegeElement = new TextMessageEncodingBindingElement();
messegeElement.MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None);
CustomBinding bind = new CustomBinding(messegeElement, httpBinding);
// Add our custom behavior - this require the Microsoft WSE 3.0 SDK
PasswordDigestBehavior behavior = new PasswordDigestBehavior(CameraASCIIStringLogin, CameraASCIIStringPassword);
DeviceClient client = new DeviceClient(bind, serviceAddress);
client.Endpoint.Behaviors.Add(behavior);
// We can now ask informations
client.GetSystemDateAndTime();
client.GetNetworkInterfaces();
client.GetScopes();
client.GetRelayOutputs();
client.GetWsdlUrl();
秘诀是在 messegeElement 中设置正确的信封设置(Soap12 因为我们的相机只支持这个,AdressingVersion.None 删除“mustunderstand”标志)并添加 Microsoft WSE 3.0 作为库,即使我在.NET 4.0 并使用 Visual Studio 2010。这将使您能够使用它们提供的 UserNameToken 函数,而无需自己从头开始重新创建它们。
关于c# - '一个 :Action' must be understood but cannot be handled and RequestSecurityToken problem on an ONVIF Camera,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5646534/
我正在使用 Apache CXF 从 Java 客户端调用 WCF 服务。该服务在另一个地址使用 STS 进行保护。我已经将服务客户端配置为在调用主服务之前调用安全 token 并且它可以工作(它正在
我正在尝试设置将使用 WSHttpBinding 进行通信的客户端(Web 应用程序)和服务(WCF 服务)。看来,为了使用此绑定(bind),客户端会发送初步消息来设置 channel 。 在客户端
使用 .Net 4.5 并使用 WIF 身份类生成 SAML2 token 并尝试将其添加到 soap 正文请求中,但它被忽略并且生成的 soap 请求实际上具有将发送到服务器的“requestsec
任何人都可以指向使用 Thread.CurrentPrincipal as ClaimsPrincipal 的 NT 凭据主动发出 RequestSecurityToken 的示例代码吗? ? 该场景
我正在尝试与 ONVIF 摄像头建立通信,但由于缺乏 Web 服务、ONVIF 和 C# 方面的经验,我遇到了一些我无法完全理解的奇怪错误。我在 .NET 4.0 上并使用 Visual Studio
我是一名优秀的程序员,十分优秀!