4 Replies Latest reply on Apr 23, 2014 10:50 PM by chriswhsu

    Strange Behavior of Pi Web API Connection to Asset Framework

    chriswhsu

      I'm seeing some unexpected behavior when accessing AF resources through the WEB API.

       

      If I make the following get requests in this order after starting the webapi process:

       

      https://some.where.berkeley.edu/piwebapi/assetservers/

       

      https://some.where.berkeley.edu/piwebapi/assetservers/S06p4VDYuL1Ua-zPLKSAbL4AU0tZUk9T/assetdatabases

       

      https://some.where.berkeley.edu/piwebapi/assetdatabases/D06p4VDYuL1Ua-zPLKSAbL4ALXOjANHWR0-uCiCb2FSBIwU0tZUk9TXENSRVNU/elements

       

      ...everything works fine.

       


      However, if after starting the webapi process, I access this directly:

       

      https://some.where.berkeley.edu/piwebapi/assetdatabases/D06p4VDYuL1Ua-zPLKSAbL4ALXOjANHWR0-uCiCb2FSBIwU0tZUk9TXENSRVNU/elements

       

      I get a server error on the first try, and then on the second try:

       

      {
      "Errors": [
      "Not found: D06p4VDYuL1Ua-zPLKSAbL4ALXOjANHWR0-uCiCb2FSBIwU0tZUk9TXENSRVNU"
      ]
      }

       

      If I go back and access the list of databasess after the above errors

       

      https://some.where.berkeley.edu/piwebapi/assetservers/S06p4VDYuL1Ua-zPLKSAbL4AU0tZUk9T/assetdatabases

       

      I get no databases listed:

       

      {
      "Links": {},
      "Items": []
      }

       


      The Web API seems to be skipping creating the AF connection unless the specific assetdatabases URL, before accessing any AF specific data.

       

      Also if I follow the order of requests that works, the connection to AF eventually times out and can only be re-established if hitting the proper URL first.  

       

      I'l also note that any data archive based queries seem to be unaffected.

       

       

       

      Here is the log:

       

      Press enter to quit.
      System.Web.Http.Request: ;;https://some.where.berkeley.edu/piwebapi/assetdatabases/D06p4VDYuL1Ua-zPLKSAbL4ALXOjANHWR0-uCiCb2FSBIwU0tZUk9TXENSRVNU/elements
      System.Web.Http.MessageHandlers: InstrumentationMessageHandler;SendAsync;
      System.Web.Http.MessageHandlers: ReadOnlyHandler;SendAsync;
      System.Web.Http.MessageHandlers: ImpersonationHandler;SendAsync;
      System.Web.Http.Controllers: DefaultHttpControllerSelector;SelectController;Route='MS_SubRoutes:System.Web.Http.Routing.IHttpRouteData[]'
      System.Web.Http.Controllers: DefaultHttpControllerSelector;SelectController;AssetDatabase
      System.Web.Http.MessageHandlers: ContextProviderHandler;SendAsync;
      System.Web.Http.MessageHandlers: HoudiniUrlHelperHandler;SendAsync;
      System.Web.Http.MessageHandlers: CorsMessageHandler;SendAsync;
      System.Web.Http.Controllers: DefaultHttpControllerSelector;SelectController;Route='MS_SubRoutes:System.Web.Http.Routing.IHttpRouteData[]'
      System.Web.Http.Controllers: DefaultHttpControllerSelector;SelectController;AssetDatabase
      System.Web.Http.Controllers: HttpControllerDescriptor;CreateController;
      System.Web.Http.Controllers: DefaultHttpControllerActivator;Create;
      System.Web.Http.Controllers: DefaultHttpControllerActivator;Create;OSIsoft.REST.Controllers.AssetDatabaseController
      System.Web.Http.Controllers: HttpControllerDescriptor;CreateController;OSIsoft.REST.Controllers.AssetDatabaseController
      System.Web.Http.Controllers: AssetDatabaseController;ExecuteAsync;
      System.Web.Http.Action: ApiControllerActionSelector;SelectAction;
      System.Web.Http.Action: ApiControllerActionSelector;SelectAction;Selected action 'GetElements(String webId, String nameFilter, String categoryName, String templateName, String elementType, Boolean searchFullHierarchy, String sortField, String sortOrd
      er, Int32 startIndex, Int32 maxCount)'
      System.Web.Http.ModelBinding: HttpActionBinding;ExecuteBindingAsync;
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Binding parameter 'webId'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Parameter 'webId' bound to the value 'D06p4VDYuL1Ua-zPLKSAbL4ALXOjANHWR0-uCiCb2FSBIwU0tZUk9TXENSRVNU'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Binding parameter 'nameFilter'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Parameter 'nameFilter' bound to the value 'null'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Binding parameter 'categoryName'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Parameter 'categoryName' bound to the value 'null'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Binding parameter 'templateName'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Parameter 'templateName' bound to the value 'null'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Binding parameter 'elementType'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Parameter 'elementType' bound to the value 'Any'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Binding parameter 'searchFullHierarchy'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Parameter 'searchFullHierarchy' bound to the value 'False'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Binding parameter 'sortField'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Parameter 'sortField' bound to the value 'Name'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Binding parameter 'sortOrder'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Parameter 'sortOrder' bound to the value 'Ascending'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Binding parameter 'startIndex'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Parameter 'startIndex' bound to the value '0'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Binding parameter 'maxCount'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Parameter 'maxCount' bound to the value '1000'
      System.Web.Http.ModelBinding: HttpActionBinding;ExecuteBindingAsync;Model state is valid. Values: webId=D06p4VDYuL1Ua-zPLKSAbL4ALXOjANHWR0-uCiCb2FSBIwU0tZUk9TXENSRVNU, nameFilter=null, categoryName=null, templateName=null, elementType=Any, searchFull
      Hierarchy=False, sortField=Name, sortOrder=Ascending, startIndex=0, maxCount=1000
      System.Web.Http.Filters: ValidationFilterAttribute;OnActionExecutingAsync;Action filter for 'GetElements(String webId, String nameFilter, String categoryName, String templateName, String elementType, Boolean searchFullHierarchy, String sortField, Str
      ing sortOrder, Int32 startIndex, Int32 maxCount)'
      System.Web.Http.Filters: ValidationFilterAttribute;OnActionExecutingAsync;
      System.Web.Http.Action: ApiControllerActionInvoker;InvokeActionAsync;Action='GetElements(webId=D06p4VDYuL1Ua-zPLKSAbL4ALXOjANHWR0-uCiCb2FSBIwU0tZUk9TXENSRVNU, nameFilter=null, categoryName=null, templateName=null, elementType=Any, searchFullHierarchy
      =False, sortField=Name, sortOrder=Ascending, startIndex=0, maxCount=1000)'
      System.Web.Http.Action: ReflectedHttpActionDescriptor;ExecuteAsync;Invoking action 'GetElements(webId=D06p4VDYuL1Ua-zPLKSAbL4ALXOjANHWR0-uCiCb2FSBIwU0tZUk9TXENSRVNU, nameFilter=null, categoryName=null, templateName=null, elementType=Any, searchFullHi
      erarchy=False, sortField=Name, sortOrder=Ascending, startIndex=0, maxCount=1000)'
      System.Web.Http.Action: ReflectedHttpActionDescriptor;ExecuteAsync;
      System.Web.Http.Action: ApiControllerActionInvoker;InvokeActionAsync;
      System.Web.Http.Filters: ValidationFilterAttribute;OnActionExecutedAsync;Action filter for 'GetElements(String webId, String nameFilter, String categoryName, String templateName, String elementType, Boolean searchFullHierarchy, String sortField, Stri
      ng sortOrder, Int32 startIndex, Int32 maxCount)'
      System.Web.Http.Filters: ValidationFilterAttribute;OnActionExecutedAsync;
      System.Web.Http.Filters: LoggingExceptionFilterAttribute;OnExceptionAsync;
      System.ServiceModel.CommunicationException: Cannot connect to server 'SKYROS'. It may be that the impersonated client user account cannot be delegated to the remote AF Server. ---> System.ServiceModel.CommunicationException: The socket connection was
      aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:04:59.9929982'. ---> System.IO.IOException: The read oper
      ation failed, see inner exception. ---> System.ServiceModel.CommunicationException: The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying n
      etwork resource issue. Local socket timeout was '00:04:59.9929982'. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
      at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
      at System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout, Boolean closing)
      --- End of inner exception stack trace ---
      at System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout, Boolean closing)
      at System.ServiceModel.Channels.SocketConnection.Read(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)
      at System.ServiceModel.Channels.DelegatingConnection.Read(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)
      at System.ServiceModel.Channels.ConnectionStream.Read(Byte[] buffer, Int32 offset, Int32 count)
      at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)
      at System.Net.Security.NegotiateStream.StartFrameHeader(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
      at System.Net.Security.NegotiateStream.ProcessRead(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
      --- End of inner exception stack trace ---
      at System.Net.Security.NegotiateStream.ProcessRead(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
      at System.Net.Security.NegotiateStream.Read(Byte[] buffer, Int32 offset, Int32 count)
      at System.ServiceModel.Channels.StreamConnection.Read(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)
      --- End of inner exception stack trace ---

       

      Server stack trace:
      at System.ServiceModel.Channels.StreamConnection.Read(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)
      at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.SendPreamble(IConnection connection, ArraySegment`1 preamble, TimeoutHelper& timeoutHelper)
      at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.DuplexConnectionPoolHelper.AcceptPooledConnection(IConnection connection, TimeoutHelper& timeoutHelper)
      at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout)
      at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)
      at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
      at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
      at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)

       

      Exception rethrown at [0]:
      at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
      at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
      at System.ServiceModel.ICommunicationObject.Open(TimeSpan timeout)
      at System.ServiceModel.ClientBase`1.System.ServiceModel.ICommunicationObject.Open(TimeSpan timeout)
      at System.ServiceModel.ClientBase`1.Open()
      at OSIsoft.AF.Support.AFProxy.Reconnect(Boolean autoPrompt, Boolean raiseEvents, AFConnectionProtocol protocol, String host, Int32 port, String accountName, TimeSpan timeout)
      --- End of inner exception stack trace ---
      at OSIsoft.AF.Support.AFProxy.Reconnect(AFCollectiveMember member, Boolean autoPrompt, Boolean raiseEvents, AFConnectionPreference preference)
      at OSIsoft.AF.Support.AFProxy.Reconnect()
      at OSIsoft.AF.Support.AFSerialProxy.Call(String rpcName, ProxyDelegate codeBlock)
      at OSIsoft.AF.Support.AFSerialProxy.GetDatabaseList(DateTime sinceTime, AFSortField sortField, AFSortOrder sortOrder, Int32 maxCount, Boolean& fullUpdate, DateTime& lastUpdateTime)
      at OSIsoft.AF.AFDatabases.LoadObjects(Int32 page, Boolean fullReload)
      at OSIsoft.AF.AFCollection`1.Load(Boolean force)
      at OSIsoft.AF.AFCollection`1.GetItemTyped(Guid id, Boolean returnDeletedItems, Boolean searchServer, Boolean inLoad)
      at OSIsoft.WebID.Restorers.DatabaseRestorer.Restore_v0(String webId)
      at OSIsoft.WebID.Restorers.DatabaseRestorer.Restore(String webId)
      at OSIsoft.WebID.WebIDRestorer.RestoreObject(String webId)
      at OSIsoft.REST.Controllers.AFUtil.Restore[T](String webId)
      at OSIsoft.REST.Controllers.AssetDatabaseController.GetElements(String webId, String nameFilter, String categoryName, String templateName, String elementType, Boolean searchFullHierarchy, String sortField, String sortOrder, Int32 startIndex, Int32
      maxCount)
      at lambda_method(Closure , Object , Object[] )
      at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)
      at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)
      at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at System.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__18`1.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at System.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__18`1.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()System.Web.Http.Filters: LoggingExceptionFilterAttribute;OnExceptionAsync;
      System.Web.Http.Controllers: AssetDatabaseController;ExecuteAsync;
      System.Web.Http.MessageHandlers: CorsMessageHandler;SendAsync;
      System.Web.Http.MessageHandlers: HoudiniUrlHelperHandler;SendAsync;
      System.Web.Http.MessageHandlers: ContextProviderHandler;SendAsync;
      System.Web.Http.MessageHandlers: ImpersonationHandler;SendAsync;
      System.Web.Http.MessageHandlers: ReadOnlyHandler;SendAsync;
      System.Web.Http.MessageHandlers: InstrumentationMessageHandler;SendAsync;
      System.Web.Http.Request: ;;Content-type='text/plain; charset=utf-8', content-length=21
      System.Web.Http.Controllers: AssetDatabaseController;Dispose;
      System.Web.Http.Controllers: AssetDatabaseController;Dispose;

       


      System.Web.Http.Request: ;;https://some.where.berkeley.edu/piwebapi/assetdatabases/D06p4VDYuL1Ua-zPLKSAbL4ALXOjANHWR0-uCiCb2FSBIwU0tZUk9TXENSRVNU/elements
      System.Web.Http.MessageHandlers: InstrumentationMessageHandler;SendAsync;
      System.Web.Http.MessageHandlers: ReadOnlyHandler;SendAsync;
      System.Web.Http.MessageHandlers: ImpersonationHandler;SendAsync;
      System.Web.Http.Controllers: DefaultHttpControllerSelector;SelectController;Route='MS_SubRoutes:System.Web.Http.Routing.IHttpRouteData[]'
      System.Web.Http.Controllers: DefaultHttpControllerSelector;SelectController;AssetDatabase
      System.Web.Http.MessageHandlers: ContextProviderHandler;SendAsync;
      System.Web.Http.MessageHandlers: HoudiniUrlHelperHandler;SendAsync;
      System.Web.Http.MessageHandlers: CorsMessageHandler;SendAsync;
      System.Web.Http.Controllers: DefaultHttpControllerSelector;SelectController;Route='MS_SubRoutes:System.Web.Http.Routing.IHttpRouteData[]'
      System.Web.Http.Controllers: DefaultHttpControllerSelector;SelectController;AssetDatabase
      System.Web.Http.Controllers: HttpControllerDescriptor;CreateController;
      System.Web.Http.Controllers: DefaultHttpControllerActivator;Create;
      System.Web.Http.Controllers: DefaultHttpControllerActivator;Create;OSIsoft.REST.Controllers.AssetDatabaseController
      System.Web.Http.Controllers: HttpControllerDescriptor;CreateController;OSIsoft.REST.Controllers.AssetDatabaseController
      System.Web.Http.Controllers: AssetDatabaseController;ExecuteAsync;
      System.Web.Http.Action: ApiControllerActionSelector;SelectAction;
      System.Web.Http.Action: ApiControllerActionSelector;SelectAction;Selected action 'GetElements(String webId, String nameFilter, String categoryName, String templateName, String elementType, Boolean searchFullHierarchy, String sortField, String sortOrd
      er, Int32 startIndex, Int32 maxCount)'
      System.Web.Http.ModelBinding: HttpActionBinding;ExecuteBindingAsync;
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Binding parameter 'webId'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Parameter 'webId' bound to the value 'D06p4VDYuL1Ua-zPLKSAbL4ALXOjANHWR0-uCiCb2FSBIwU0tZUk9TXENSRVNU'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Binding parameter 'nameFilter'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Parameter 'nameFilter' bound to the value 'null'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Binding parameter 'categoryName'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Parameter 'categoryName' bound to the value 'null'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Binding parameter 'templateName'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Parameter 'templateName' bound to the value 'null'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Binding parameter 'elementType'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Parameter 'elementType' bound to the value 'Any'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Binding parameter 'searchFullHierarchy'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Parameter 'searchFullHierarchy' bound to the value 'False'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Binding parameter 'sortField'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Parameter 'sortField' bound to the value 'Name'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Binding parameter 'sortOrder'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Parameter 'sortOrder' bound to the value 'Ascending'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Binding parameter 'startIndex'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Parameter 'startIndex' bound to the value '0'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Binding parameter 'maxCount'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Parameter 'maxCount' bound to the value '1000'
      System.Web.Http.ModelBinding: HttpActionBinding;ExecuteBindingAsync;Model state is valid. Values: webId=D06p4VDYuL1Ua-zPLKSAbL4ALXOjANHWR0-uCiCb2FSBIwU0tZUk9TXENSRVNU, nameFilter=null, categoryName=null, templateName=null, elementType=Any, searchFull
      Hierarchy=False, sortField=Name, sortOrder=Ascending, startIndex=0, maxCount=1000
      System.Web.Http.Filters: ValidationFilterAttribute;OnActionExecutingAsync;Action filter for 'GetElements(String webId, String nameFilter, String categoryName, String templateName, String elementType, Boolean searchFullHierarchy, String sortField, Str
      ing sortOrder, Int32 startIndex, Int32 maxCount)'
      System.Web.Http.Filters: ValidationFilterAttribute;OnActionExecutingAsync;
      System.Web.Http.Action: ApiControllerActionInvoker;InvokeActionAsync;Action='GetElements(webId=D06p4VDYuL1Ua-zPLKSAbL4ALXOjANHWR0-uCiCb2FSBIwU0tZUk9TXENSRVNU, nameFilter=null, categoryName=null, templateName=null, elementType=Any, searchFullHierarchy
      =False, sortField=Name, sortOrder=Ascending, startIndex=0, maxCount=1000)'
      System.Web.Http.Action: ReflectedHttpActionDescriptor;ExecuteAsync;Invoking action 'GetElements(webId=D06p4VDYuL1Ua-zPLKSAbL4ALXOjANHWR0-uCiCb2FSBIwU0tZUk9TXENSRVNU, nameFilter=null, categoryName=null, templateName=null, elementType=Any, searchFullHi
      erarchy=False, sortField=Name, sortOrder=Ascending, startIndex=0, maxCount=1000)'
      System.Web.Http.Action: ReflectedHttpActionDescriptor;ExecuteAsync;
      System.Web.Http.Action: ApiControllerActionInvoker;InvokeActionAsync;
      System.Web.Http.Filters: ValidationFilterAttribute;OnActionExecutedAsync;Action filter for 'GetElements(String webId, String nameFilter, String categoryName, String templateName, String elementType, Boolean searchFullHierarchy, String sortField, Stri
      ng sortOrder, Int32 startIndex, Int32 maxCount)'
      System.Web.Http.Filters: ValidationFilterAttribute;OnActionExecutedAsync;
      System.Web.Http.Filters: LoggingExceptionFilterAttribute;OnExceptionAsync;
      OSIsoft.REST.PIWebException: Not found: D06p4VDYuL1Ua-zPLKSAbL4ALXOjANHWR0-uCiCb2FSBIwU0tZUk9TXENSRVNU
      at OSIsoft.REST.Controllers.AFUtil.Restore[T](String webId)
      at OSIsoft.REST.Controllers.AssetDatabaseController.GetElements(String webId, String nameFilter, String categoryName, String templateName, String elementType, Boolean searchFullHierarchy, String sortField, String sortOrder, Int32 startIndex, Int32
      maxCount)
      at lambda_method(Closure , Object , Object[] )
      at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)
      at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)
      at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at System.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__18`1.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at System.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__18`1.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()System.Net.Http.Formatting: DefaultContentNegotiator;Negotiate;Type='ErrorsDTO', formatters=[JsonMediaTypeFormatterTracer, BufferedMediaTypeFormatterTracer]
      System.Net.Http.Formatting: HtmlMediaTypeFormatter;GetPerRequestFormatterInstance;Obtaining formatter of type 'HtmlMediaTypeFormatter' for type='ErrorsDTO', mediaType='text/html'
      System.Net.Http.Formatting: HtmlMediaTypeFormatter;GetPerRequestFormatterInstance;Will use new 'HtmlMediaTypeFormatter' formatter
      System.Net.Http.Formatting: DefaultContentNegotiator;Negotiate;Selected formatter='HtmlMediaTypeFormatter', content-type='text/html'
      System.Web.Http.Filters: LoggingExceptionFilterAttribute;OnExceptionAsync;
      System.Web.Http.Controllers: AssetDatabaseController;ExecuteAsync;
      System.Web.Http.MessageHandlers: CorsMessageHandler;SendAsync;
      System.Web.Http.MessageHandlers: HoudiniUrlHelperHandler;SendAsync;
      System.Web.Http.MessageHandlers: ContextProviderHandler;SendAsync;
      System.Web.Http.MessageHandlers: ImpersonationHandler;SendAsync;
      System.Web.Http.MessageHandlers: ReadOnlyHandler;SendAsync;
      System.Web.Http.MessageHandlers: InstrumentationMessageHandler;SendAsync;
      System.Web.Http.Request: ;;Content-type='text/html', content-length=unknown
      System.Net.Http.Formatting: HtmlMediaTypeFormatter;WriteToStream;Value='OSIsoft.REST.Models.ErrorsDTO', type='ErrorsDTO', content-type='text/html'
      System.Net.Http.Formatting: HtmlMediaTypeFormatter;WriteToStream;
      System.Web.Http.Controllers: AssetDatabaseController;Dispose;
      System.Web.Http.Controllers: AssetDatabaseController;Dispose;

       

      System.Web.Http.Request: ;;https://some.where.berkeley.edu/piwebapi/assetservers
      System.Web.Http.MessageHandlers: InstrumentationMessageHandler;SendAsync;
      System.Web.Http.MessageHandlers: ReadOnlyHandler;SendAsync;
      System.Web.Http.MessageHandlers: ImpersonationHandler;SendAsync;
      System.Web.Http.Controllers: DefaultHttpControllerSelector;SelectController;Route='MS_SubRoutes:System.Web.Http.Routing.IHttpRouteData[]'
      System.Web.Http.Controllers: DefaultHttpControllerSelector;SelectController;AssetServer
      System.Web.Http.MessageHandlers: ContextProviderHandler;SendAsync;
      System.Web.Http.MessageHandlers: HoudiniUrlHelperHandler;SendAsync;
      System.Web.Http.MessageHandlers: CorsMessageHandler;SendAsync;
      System.Web.Http.Controllers: DefaultHttpControllerSelector;SelectController;Route='MS_SubRoutes:System.Web.Http.Routing.IHttpRouteData[]'
      System.Web.Http.Controllers: DefaultHttpControllerSelector;SelectController;AssetServer
      System.Web.Http.Controllers: HttpControllerDescriptor;CreateController;
      System.Web.Http.Controllers: DefaultHttpControllerActivator;Create;
      System.Web.Http.Controllers: DefaultHttpControllerActivator;Create;OSIsoft.REST.Controllers.AssetServerController
      System.Web.Http.Controllers: HttpControllerDescriptor;CreateController;OSIsoft.REST.Controllers.AssetServerController
      System.Web.Http.Controllers: AssetServerController;ExecuteAsync;
      System.Web.Http.Action: ApiControllerActionSelector;SelectAction;
      System.Web.Http.Action: ApiControllerActionSelector;SelectAction;Selected action 'List()'
      System.Web.Http.ModelBinding: HttpActionBinding;ExecuteBindingAsync;
      System.Web.Http.ModelBinding: HttpActionBinding;ExecuteBindingAsync;
      System.Web.Http.Filters: ValidationFilterAttribute;OnActionExecutingAsync;Action filter for 'List()'
      System.Web.Http.Filters: ValidationFilterAttribute;OnActionExecutingAsync;
      System.Web.Http.Action: ApiControllerActionInvoker;InvokeActionAsync;Action='List()'
      System.Web.Http.Action: ReflectedHttpActionDescriptor;ExecuteAsync;Invoking action 'List()'
      System.Net.Http.Formatting: DefaultContentNegotiator;Negotiate;Type='ItemsDTO`1', formatters=[JsonMediaTypeFormatterTracer, BufferedMediaTypeFormatterTracer]
      System.Net.Http.Formatting: HtmlMediaTypeFormatter;GetPerRequestFormatterInstance;Obtaining formatter of type 'HtmlMediaTypeFormatter' for type='ItemsDTO`1', mediaType='text/html'
      System.Net.Http.Formatting: HtmlMediaTypeFormatter;GetPerRequestFormatterInstance;Will use new 'HtmlMediaTypeFormatter' formatter
      System.Net.Http.Formatting: DefaultContentNegotiator;Negotiate;Selected formatter='HtmlMediaTypeFormatter', content-type='text/html'
      System.Web.Http.Action: ReflectedHttpActionDescriptor;ExecuteAsync;Action returned 'StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.ObjectContent`1[[OSIsoft.REST.Models.ItemsDTO`1[[OSIsoft.REST.Models.AssetServerDTO, OSIso
      ft.REST, Version=1.1.0.0, Culture=neutral, PublicKeyToken=602992a96984cad9]], OSIsoft.REST, Version=1.1.0.0, Culture=neutral, PublicKeyToken=602992a96984cad9]], Headers:
      {
      Content-Type: text/html
      }'
      System.Web.Http.Action: ApiControllerActionInvoker;InvokeActionAsync;
      System.Web.Http.Filters: ValidationFilterAttribute;OnActionExecutedAsync;Action filter for 'List()'
      System.Web.Http.Filters: ValidationFilterAttribute;OnActionExecutedAsync;
      System.Web.Http.Controllers: AssetServerController;ExecuteAsync;
      System.Web.Http.MessageHandlers: CorsMessageHandler;SendAsync;
      System.Web.Http.MessageHandlers: HoudiniUrlHelperHandler;SendAsync;
      System.Web.Http.MessageHandlers: ContextProviderHandler;SendAsync;
      System.Web.Http.MessageHandlers: ImpersonationHandler;SendAsync;
      System.Web.Http.MessageHandlers: ReadOnlyHandler;SendAsync;
      System.Web.Http.MessageHandlers: InstrumentationMessageHandler;SendAsync;
      System.Web.Http.Request: ;;Content-type='text/html', content-length=unknown
      System.Net.Http.Formatting: HtmlMediaTypeFormatter;WriteToStream;Value='OSIsoft.REST.Models.ItemsDTO`1[OSIsoft.REST.Models.AssetServerDTO]', type='ItemsDTO`1', content-type='text/html'
      System.Net.Http.Formatting: HtmlMediaTypeFormatter;WriteToStream;
      System.Web.Http.Controllers: AssetServerController;Dispose;
      System.Web.Http.Controllers: AssetServerController;Dispose;

       


      System.Web.Http.Request: ;;https://some.where.berkeley.edu/piwebapi/assetservers/S06p4VDYuL1Ua-zPLKSAbL4AU0tZUk9T/assetdatabases
      System.Web.Http.MessageHandlers: InstrumentationMessageHandler;SendAsync;
      System.Web.Http.MessageHandlers: ReadOnlyHandler;SendAsync;
      System.Web.Http.MessageHandlers: ImpersonationHandler;SendAsync;
      System.Web.Http.Controllers: DefaultHttpControllerSelector;SelectController;Route='MS_SubRoutes:System.Web.Http.Routing.IHttpRouteData[]'
      System.Web.Http.Controllers: DefaultHttpControllerSelector;SelectController;AssetServer
      System.Web.Http.MessageHandlers: ContextProviderHandler;SendAsync;
      System.Web.Http.MessageHandlers: HoudiniUrlHelperHandler;SendAsync;
      System.Web.Http.MessageHandlers: CorsMessageHandler;SendAsync;
      System.Web.Http.Controllers: DefaultHttpControllerSelector;SelectController;Route='MS_SubRoutes:System.Web.Http.Routing.IHttpRouteData[]'
      System.Web.Http.Controllers: DefaultHttpControllerSelector;SelectController;AssetServer
      System.Web.Http.Controllers: HttpControllerDescriptor;CreateController;
      System.Web.Http.Controllers: DefaultHttpControllerActivator;Create;
      System.Web.Http.Controllers: DefaultHttpControllerActivator;Create;OSIsoft.REST.Controllers.AssetServerController
      System.Web.Http.Controllers: HttpControllerDescriptor;CreateController;OSIsoft.REST.Controllers.AssetServerController
      System.Web.Http.Controllers: AssetServerController;ExecuteAsync;
      System.Web.Http.Action: ApiControllerActionSelector;SelectAction;
      System.Web.Http.Action: ApiControllerActionSelector;SelectAction;Selected action 'GetDatabases(String webId)'
      System.Web.Http.ModelBinding: HttpActionBinding;ExecuteBindingAsync;
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Binding parameter 'webId'
      System.Web.Http.ModelBinding: ModelBinderParameterBinding;ExecuteBindingAsync;Parameter 'webId' bound to the value 'S06p4VDYuL1Ua-zPLKSAbL4AU0tZUk9T'
      System.Web.Http.ModelBinding: HttpActionBinding;ExecuteBindingAsync;Model state is valid. Values: webId=S06p4VDYuL1Ua-zPLKSAbL4AU0tZUk9T
      System.Web.Http.Filters: ValidationFilterAttribute;OnActionExecutingAsync;Action filter for 'GetDatabases(String webId)'
      System.Web.Http.Filters: ValidationFilterAttribute;OnActionExecutingAsync;
      System.Web.Http.Action: ApiControllerActionInvoker;InvokeActionAsync;Action='GetDatabases(webId=S06p4VDYuL1Ua-zPLKSAbL4AU0tZUk9T)'
      System.Web.Http.Action: ReflectedHttpActionDescriptor;ExecuteAsync;Invoking action 'GetDatabases(webId=S06p4VDYuL1Ua-zPLKSAbL4AU0tZUk9T)'
      System.Net.Http.Formatting: DefaultContentNegotiator;Negotiate;Type='ItemsDTO`1', formatters=[JsonMediaTypeFormatterTracer, BufferedMediaTypeFormatterTracer]
      System.Net.Http.Formatting: HtmlMediaTypeFormatter;GetPerRequestFormatterInstance;Obtaining formatter of type 'HtmlMediaTypeFormatter' for type='ItemsDTO`1', mediaType='text/html'
      System.Net.Http.Formatting: HtmlMediaTypeFormatter;GetPerRequestFormatterInstance;Will use new 'HtmlMediaTypeFormatter' formatter
      System.Net.Http.Formatting: DefaultContentNegotiator;Negotiate;Selected formatter='HtmlMediaTypeFormatter', content-type='text/html'
      System.Web.Http.Action: ReflectedHttpActionDescriptor;ExecuteAsync;Action returned 'StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.ObjectContent`1[[OSIsoft.REST.Models.ItemsDTO`1[[OSIsoft.REST.Models.AssetDatabaseDTO, OSI
      soft.REST, Version=1.1.0.0, Culture=neutral, PublicKeyToken=602992a96984cad9]], OSIsoft.REST, Version=1.1.0.0, Culture=neutral, PublicKeyToken=602992a96984cad9]], Headers:
      {
      Content-Type: text/html
      }'
      System.Web.Http.Action: ApiControllerActionInvoker;InvokeActionAsync;
      System.Web.Http.Filters: ValidationFilterAttribute;OnActionExecutedAsync;Action filter for 'GetDatabases(String webId)'
      System.Web.Http.Filters: ValidationFilterAttribute;OnActionExecutedAsync;
      System.Web.Http.Controllers: AssetServerController;ExecuteAsync;
      System.Web.Http.MessageHandlers: CorsMessageHandler;SendAsync;
      System.Web.Http.MessageHandlers: HoudiniUrlHelperHandler;SendAsync;
      System.Web.Http.MessageHandlers: ContextProviderHandler;SendAsync;
      System.Web.Http.MessageHandlers: ImpersonationHandler;SendAsync;
      System.Web.Http.MessageHandlers: ReadOnlyHandler;SendAsync;
      System.Web.Http.MessageHandlers: InstrumentationMessageHandler;SendAsync;
      System.Web.Http.Request: ;;Content-type='text/html', content-length=unknown
      System.Net.Http.Formatting: HtmlMediaTypeFormatter;WriteToStream;Value='OSIsoft.REST.Models.ItemsDTO`1[OSIsoft.REST.Models.AssetDatabaseDTO]', type='ItemsDTO`1', content-type='text/html'
      System.Net.Http.Formatting: HtmlMediaTypeFormatter;WriteToStream;
      System.Web.Http.Controllers: AssetServerController;Dispose;
      System.Web.Http.Controllers: AssetServerController;Dispose;

        • Re: Strange Behavior of Pi Web API Connection to Asset Framework
          Bhess

          Sorry about that, Chris.  There is a known bug in the Beta, where the requesting user isn't impersonated properly in some contexts.

           

          Resources starting with the following roots are affected (i.e., you won't see errors if your user doesn't have privileges to connect):

           

          /assetservers

           

          /attributes

           

          /streams

           

          This ends up masking the underlying problem that you have, where your user account is actually not able to connect to the AF server on the backend, as per your stack trace:

           

          Cannot connect to server 'SKYROS'. It may be that the impersonated client user account cannot be delegated to the remote AF Server.

           

          Is the process account that's running the PI Web API set up for delegation in Active Directory?

           

          As a temporary workaround, it might be preferable to disable security to work around these problems, pending an updated PI Web API release that handles this better.  You can do this by adding a configuration item named 'BypassAuth' with a value of true (boolean).

           

          Brad