Analysis of OsiSoft’s PI Web API

Content of the Web API folder is placed to \\yyyy\d$\WebApp\PIWebApi. Then try to perform command line operation by invoking OSIsoft.REST.Host.exe with administrative privilege, but it exits as soon as it is get called.

Perform WinDBG and event filter for CLR Exception, it shows that the application throws DirectoryNotFoundException

And the source of the Exception is from InstallUtil.DataDirectory, which contains null value. By examining the source using ILSpy, the DataDirectory is retrieved from registry called HKLM\Software\PISystem\WebAPI.

Perform registry import from source server to destination. Now the server application runs without exit. But the question arise, how to access the server using web client ? In other words, what URL that the client required to be sent to the server ?

After some investigations, it is found that the application responds only to PIWebAPI url link. But when trying to access the link using browser, it gets only HTTP 500 error.

In the source server, the application is run inside service framework, let’s try this:

But as soon as the service is started, it is abruptly stopped. And show this error message:

Checking on Event Viewer I have:

Let’s try again in command line mode with administrative privilege and perform breakpoint at the System.Net.HttpListener.AddAllPrefixes method. There is no exception error.

Using ILSpy, the AddAllPrefixes method is actually using the unmanaged API call to HttpAddUrlToUrlGroup. The call is a success, but as I described above, it causes HTTP 500 error.

In the source server, I try to stop the service and run the application in command line mode, yielding the similar result, a blank page in a browser. So, seems that PI Web API can not run in command line mode. So I will leave it at that, and pursue the service framework instead.

Later on, I’ve found that the registered URL in HTTP Server in windows can be viewed using netsh command:

To see whether the service is creating the above URL registration link, I try to stop the service, and when the service is stopped, the registered URL is still there !

Later on, I’ve found that to perform URL registration can be done using netsh also:

But the error says Url reservation add failed, Error: 87 The parameter is incorrect.

Should be this one:

Run the application using service framework. This time there are no Access Denied run time error message, and in the browser at last I have:

This concludes the preliminary analysis of the application.

You can leave a response, or trackback from your own site.

29 Responses to “Analysis of OsiSoft’s PI Web API”

  1. Pilar Pladson

    I found a great…

  2. Noble Grabow says:

    With thanks! Valuable information!

  3. Don’t wear seat belts lest you drown in your own urine?

  4. Karl Soja says:

    With thanks! Valuable information!

  5. Black on black in the Charger I’m creepin’ Rub me the right way, you might get a genie B.o.B, black Houdini

  6. Fritz Pardee says:

    Don’t wear seat belts lest you drown in you own urine?

  7. With thanks! Valuable information!

  8. Black on black in the Charg I’m creepin’ Rub me the right way, you might get a genie B.o.B, black Houdini

  9. Rodger Strem says:

    Don’t wear seat belts lest you drown in your own urine?

  10. Amee Poarch says:

    With thanks! Valuable information!

  11. Elvin Biley says:

    With thanks! Valuable information!

  12. With thanks! Valuable information!

  13. With thanks! Valuable information!

  14. Annalee Como says:

    Don’t wear seat belts lest you drown in you own urine?

  15. With thanks! Valuable information!

  16. Don’t wear seat belts lest you drown in your own urine?

  17. Don’t wear seat belts lest you drown in you own urine?

  18. Don’t wear seat belts lest you drown in your own urine?

  19. Paul Zapico says:

    Don’t wear seat belts lest you drown in your own urine?

  20. With thanks! Valuable information!

  21. Don’t wear seat belts lest you drown in your own urine?

  22. Black on black in the Charg I’m creepin’ Rub me the right way, you might get a genie B.o.B, black Houdini

  23. Don’t wear seat belts lest you drown in you own urine?

  24. Jesica Esau says:

    Black on black in the Charger I’m creepin’ Rub me the right way, you might get a genie B.o.B, black Houdini

  25. Don’t wear seat belts lest you drown in you own urine?

  26. Black on black in the Charg I’m creepin’ Rub me the right way, you might get a genie B.o.B, black Houdini

  27. Don’t wear seat belts lest you drown in your own urine?

  28. Waylon Redwine

    I found a great…

  29. Johnson Seu says:

    Black on black in the Charger I’m creepin’ Rub me the right way, you might get a genie B.o.B, black Houdini

Leave a Reply

Powered by WordPress and Bootstrap4