Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/299.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 不支持例外:System.ServiceModel.Channel.BufferManager-Hololens 2&;用于.NET的OPC UA SDK_C#_.net_Unity3d_Hololens_Opc Ua - Fatal编程技术网

C# 不支持例外:System.ServiceModel.Channel.BufferManager-Hololens 2&;用于.NET的OPC UA SDK

C# 不支持例外:System.ServiceModel.Channel.BufferManager-Hololens 2&;用于.NET的OPC UA SDK,c#,.net,unity3d,hololens,opc-ua,C#,.net,Unity3d,Hololens,Opc Ua,我正在尝试使用OPC UA协议读取Hololens2上节点的值 我正在使用OPC UA SDK for.NET(OPC.UaFx.Client 2.14.0)。我使用以下代码连接到服务器: public bool ConnectToOpcUaMachine(string machineIp) { try { _client = new OpcClient(machineIp); _client.OperationTimeout = 2000;

我正在尝试使用OPC UA协议读取Hololens2上节点的值

我正在使用OPC UA SDK for.NET(OPC.UaFx.Client 2.14.0)。我使用以下代码连接到服务器:

public bool ConnectToOpcUaMachine(string machineIp) {
    try {
        _client = new OpcClient(machineIp);
        _client.OperationTimeout = 2000;
        _client.Connect();
    } catch( System.Exception ex ) {
        Debug.Log("Couldn't connect to OPC server");
        Debug.LogException(ex);
        return false;
    }
    return true;
}
当我在编辑器中调用此方法时,我成功地连接到服务器,并且可以读取节点值。然而,当我尝试在全息透镜2上做同样的事情时,我得到以下错误:

NotSupportedException: System.ServiceModel.Channels.BufferManager::CreateBufferManager
  at System.ServiceModel.Channels.BufferManager.CreateBufferManager (System.Int64 maxBufferPoolSize, System.Int32 maxBufferSize) [0x00000] in <00000000000000000000000000000000>:0 
  at Opc.Ua.Bindings.BufferManager..ctor (System.String name, System.Int32 maxPoolSize, System.Int32 maxBufferSize) [0x00000] in <00000000000000000000000000000000>:0 
  at Opc.Ua.Bindings.UaSCUaBinaryTransportChannel.SaveSettings (System.Uri url, Opc.Ua.TransportChannelSettings settings) [0x00000] in <00000000000000000000000000000000>:0 
  at Opc.Ua.Bindings.UaSCUaBinaryTransportChannel.Initialize (System.Uri url, Opc.Ua.TransportChannelSettings settings) [0x00000] in <00000000000000000000000000000000>:0 
  at Opc.Ua.WcfChannelBase.CreateUaBinaryChannel (Opc.Ua.ApplicationConfiguration configuration, Opc.Ua.EndpointDescription description, Opc.Ua.EndpointConfiguration endpointConfiguration, System.Security.Cryptography.X509Certificates.X509Certificate2 clientCertificate, Opc.Ua.ServiceMessageContext messageContext) [0x00000] in <00000000000000000000000000000000>:0 
  at Opc.Ua.DiscoveryChannel.Create (System.Uri discoveryUrl, Opc.Ua.EndpointConfiguration endpointConfiguration, Opc.Ua.ServiceMessageContext messageContext) [0x00000] in <00000000000000000000000000000000>:0 
  at Opc.Ua.DiscoveryClient.Create (System.Uri discoveryUrl, Opc.Ua.EndpointConfiguration configuration) [0x00000] in <00000000000000000000000000000000>:0 
  at va..ctor (System.Uri a, Opc.UaFx.OpcApplicationConfiguration b) [0x00000] in <00000000000000000000000000000000>:0 
  at Opc.UaFx.Client.OpcDiscoveryClient..ctor (System.Uri discoveryUrl, Opc.UaFx.OpcApplicationConfiguration configuration) [0x00000] in <00000000000000000000000000000000>:0 
  at Opc.UaFx.Client.OpcClient.a (System.Uri a, Opc.UaFx.OpcApplicationConfiguration b) [0x00000] in <00000000000000000000000000000000>:0 
  at Opc.UaFx.Client.OpcClient.a () [0x00000] in <00000000000000000000000000000000>:0 
  at Opc.UaFx.Client.OpcClient.ConnectCore () [0x00000] in <00000000000000000000000000000000>:0 
  at Opc.UaFx.Client.OpcClient.Connect () [0x00000] in <00000000000000000000000000000000>:0 
  at OpcUaClientScript.ConnectToOpcUaMachine (System.String machineIp) [0x00000] in <00000000000000000000000000000000>:0 
  at OpcUaClientScript.GetDebugVal () [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.Events.UnityAction.Invoke () [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.Events.InvokableCall.Invoke () [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.Events.UnityEvent.Invoke () [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.UI.Button.Press () [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1].Invoke (T1 handler, UnityEngine.EventSystems.BaseEventData eventData) [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.EventSystems.StandaloneInputModule.ReleaseMouse (UnityEngine.EventSystems.PointerEventData pointerEvent, UnityEngine.GameObject currentOverGo) [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.EventSystems.StandaloneInputModule.ProcessMousePress (UnityEngine.EventSystems.PointerInputModule+MouseButtonEventData data) [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.EventSystems.StandaloneInputModule.ProcessMouseEvent (System.Int32 id) [0x00000] in <00000000000000000000000000000000>:0 
  at Microsoft.MixedReality.Toolkit.Input.MixedRealityInputModule.Process () [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.EventSystems.EventSystem.Update () [0x00000] in <00000000000000000000000000000000>:0 
NotSupportedException:System.ServiceModel.Channel.BufferManager::CreateBufferManager
位于:0中的System.ServiceModel.Channel.BufferManager.CreateBufferManager(System.Int64 maxBufferPoolSize,System.Int32 maxBufferSize)[0x00000]
在Opc.Ua.Bindings.BufferManager..ctor(System.String名称、System.Int32 maxPoolSize、System.Int32 maxBufferSize)[0x00000]中:0
位于:0中的Opc.Ua.Bindings.UaSCUaBinaryTransportChannel.SaveSettings(System.Uri url,Opc.Ua.TransportChannelSettings设置)[0x00000]
在:0中的Opc.Ua.Bindings.UaSCUaBinaryTransportChannel.Initialize(System.Uri url,Opc.Ua.TransportChannelSettings设置)[0x00000]处
在Opc.Ua.WcfChannelBase.CreateUaBinaryChannel(Opc.Ua.ApplicationConfiguration配置、Opc.Ua.EndpointDescription描述、Opc.Ua.EndpointConfiguration EndpointConfiguration、System.Security.Cryptography.X509Certificates.X509Certificate2客户端证书、Opc.Ua.ServiceMessageContext messageContext)[0x00000]中:0
在Opc.Ua.DiscoveryChannel.Create(System.Uri discoveryUrl、Opc.Ua.EndpointConfiguration EndpointConfiguration、Opc.Ua.ServiceMessageContext messageContext)[0x00000]中:0
在:0中的Opc.Ua.DiscoveryClient.Create(System.Uri discoveryUrl、Opc.Ua.EndpointConfiguration配置)[0x00000]处
在va..ctor(System.Uri a、Opc.UaFx.opcapApplicationConfiguration b)[0x00000]中:0
在:0中的Opc.UaFx.Client.OpcDiscoveryClient..ctor(System.Uri discoveryUrl、Opc.UaFx.opcapapplicationconfiguration)[0x00000]处
在:0中的Opc.UaFx.Client.OpcClient.a(System.Uri a,Opc.UaFx.opcapapplicationconfiguration b)[0x00000]处
位于:0中的Opc.UaFx.Client.OpcClient.a()[0x00000]
位于:0中的Opc.UaFx.Client.OpcClient.ConnectCore()[0x00000]
位于:0中的Opc.UaFx.Client.OpcClient.Connect()[0x00000]
在:0中的OpcUaClientScript.ConnectToOpcUaMachine(System.String machineIp)[0x00000]处
在:0中的OpcUaClientScript.GetDebugVal()[0x00000]处
在:0中的UnityEngine.Events.UnityAction.Invoke()[0x00000]处
在:0中的UnityEngine.Events.InvokableCall.Invoke()[0x00000]处
在:0中的UnityEngine.Events.UnityEvent.Invoke()[0x00000]处
在UnityEngine.UI.Button.Press()处,按[0x00000]键,输入:0
在UnityEngine.UI.Button.OnPointerClick(UnityEngine.EventSystems.PointerEventData eventData)[0x00000]处,输入:0
位于:0中的UnityEngine.EventSystems.ExecuteEvents.Execute(UnityEngine.EventSystems.IPointerClickHandler,UnityEngine.EventSystems.BaseEventData事件处理程序)[0x00000]处
在UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1].Invoke(T1处理程序,UnityEngine.EventSystems.BaseEventData eventData)[0x00000]中:0
在UnityEngine.EventSystems.ExecuteeEvents.Execute[T](UnityEngine.GameObject目标,UnityEngine.EventSystems.BaseEventData事件数据,UnityEngine.EventSystems.ExecuteeEvents+EventFunction`1[T1]函子)[0x00000]中:0
在UnityEngine.EventSystems.StandaloneInputModule.ReleaseMouse(UnityEngine.EventSystems.PointerEventData pointerEvent,UnityEngine.GameObject currentOverGo)[0x00000]中:0
在UnityEngine.EventSystems.StandaloneInputModule.ProcessMousePress(UnityEngine.EventSystems.PointerInputModule+MouseButtonEventData数据)[0x00000]中,输入:0
在:0中的UnityEngine.EventSystems.StandaloneInputModule.ProcessMouseeEvent(System.Int32 id)[0x00000]处
在Microsoft.MixedReality.Toolkit.Input.MixedRealityInputModule.Process()[0x00000]中:0
位于:0中的UnityEngine.EventSystems.EventSystem.Update()[0x00000]处

HoloLens应用程序在构建项目时使用IL2CPP脚本后端,它具有一些固有的特性。此外,我注意到有一个已解决的问题,反馈OPC UA与Unity IL2CPP脚本后端的兼容性问题,可能对您有帮助: