Hosting asp.net on mono xsp - raspberry pi - asp.net

I'm trying to run the sample application that comes with xsp package on my Raspberry Pi (running arch linux), but unfortunately apparently the connection is closed before any http response is sent to the browser. I get on chrome the "NO DATA RECEIVED" message.
xsp however just outputs "Application_Start" and nothing else happens (other than chrome saying no data received)
Here's what I do:
$ xsp2
xsp2
Listening on address: 0.0.0.0
Root directory: /srv/http/test
Listening on port: 8080 (non-secure)
Hit Return to stop the server.
Application_Start
And Chrome's output:
No data received
Unable to load the webpage because the server sent no data.
Here are some suggestions:
Reload this webpage later.
Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.
Of course on my Linux PC box it runs fine.
If anyone got any insights other than I'm trying to take too much out of my $35 board, let me know?

For the information of whoever visits this page:
Raspberry pi does not have an official mono implementation on hard float operations. That's why a lot of mono stuff will NOT work, including xsp =]
A gentleman posted on raspberry pi forums an experimental version of mono with an implementation of hard-float which form me worked fine. The post is here.
For Arch Linux users, I've come up with a package build so that you can create an arch linux package, and posted on the same thread. Exactly here. Instructions on how to build it are also there.
Running xsp will work after this, at least for me it did. I also did use .NET to handle GPIO and all worked beautifully.
Hopefully this helps! =]

With a bit of reflection and a socket server it's not that hard to create your own asp.net host (well I got it to support <% %> syntax with code behind and user controls (don't use/want the built in controls since they are less portable and not as transparent as I'd like)). Works fine on my arch berry.
Or you could try the self hosting from MS http://www.asp.net/web-api/overview/hosting-aspnet-web-api/self-host-a-web-api, not sure if it works with mono though (but do let us know if it does ;)).

If you are using the Raspbian distribution the Mono packages are having issues compiling and the ones that are out there have issues running .Net applications because of the specific processor features Raspbian takes advantage of. You have to use the older Debian that does not use the Hard Float armhf.
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=66&t=11634&start=75

Related

Every time I use expo client, my http network fails to work

TCP connections work fine as I am able to converse with someone over zoom and teamviewer. However, whenever I attempt to access another webpage, I get a network error. Google seems to work fine for some reason but any webpage I go to listed by Google fails to connect. The only way I can open up my http connections is by ending a task called "init" inside of task manager. This shuts down my vscode as well as my ubuntu terminals I have running. If someone knows the solution please do tell. It's really annoying having to close out my vscode and terminals as well as my local servers to look up information and debug.
I found a fix to this issue.
So I was running a Windows Subsystem for Linux and my Windows Build was outdated as well as WSL. When I updated Windows and upgraded to WSL2, my issue was resolved and I don't seem to get any more network errors.

Qt application running with `-platform offscreen` argument cannot establish websocket connection

I have a GUI application which contains a websocket server QWebSocketServer. I also have a python script which sends messages and the application processes them. Everything works well. During testing I wanted to run the application in headless mode using -platform offscreen command line argument added to the app executable name (I changed nothing else). But the problem is that when the application runs off-screen, the client script cannot establish connection with the web socket server. I tested this on localhost only. I do not understand how this two things, visibility of GUI and websockets, can interfere. Any ideas what could go wrong?
Note: I am using Qt 5.11.1 64-bit with VS 2017 on Windows 10 Pro.
A platform plugin is a bit more than merely "GUI". The -platform option selects a family of platform-specific plugins. Perhaps some plugins that make networking work are absent on that platform spec. That's very likely, since the offscreen platform is only a proof-of-concept: it's to show how you'd write a platform plugin. It's example code, and it does the bare minimum needed. It's nothing that you should be using for production without fully understanding what's there and how it works - it wasn't not meant for it, at least not the last time I looked at it. It shouldn't be hard to make it work, but you'd need to clone the source and start hacking on it.

How do I get the Emulator on the same network as my PC?

I've created some Web API methods in .NET 4 / Visual Studio 2010 (and have now ported it to VS 2013 RC).
I want to consume them from a Windows CE / Compact Framework app using RestSharp.
Regardless of how I call these methods, though, I need to know the IP Address to use for the app running the Web API methods. I can access it from a browser using "localhost" and the port number Visual Studio displays when running the View for the Web API project in the browser (works fine, returns XML in Chrome).
But: how can I call it from my Windows CE / Compact Framework app? The emulator in which I run it doesn't believe that it and localhost are really on the same machine, so I can't use that, nor the machine's actual IP address as, again, it is delusional about who/where it is.
So: what is the workaround? How can I test this?
More details about this can be seen here: RFC on HttpWebRequest vs RESTSharp from Windows CE / Compact Framework 3.5
UPDATE
Vasily, my guess was that you meant for me to do this:
...but that led to this:
Note: I get the same when I choose the other option from the dropdown asociated with the "Enable NE2000 PCMCIA network adapter and bind to:" czechbox, namely "Intel(R) 82579LM Gigabit Network Connection".
And trying to install http://go.microsoft.com/fwlink/?linkid=46859 (both the 64-bit and the 32-bit flavors) slapped me with:
So tell me, I implore: Is there balm in Gilead, so that there may be joy in Mudville tonight?
UPDATE 2
In step 6 (bullet 6), I did this:
...which got me first a message that the software didn't install correctly, with the option to retry or assert that, no, everything is really fine (I chose the latter), but then this:
...IOW, I don't make it to step/bullet point 7
Then again, this Peek cat did warn, "Note that this is very much a “works on my machine” experience. If it burns your house down, don’t hold me responsible."
My house didn't burn down (I don't think - I'm not there right now), but the process to extract the file did fail ignominiously.
You can use workstation network card by the emulator. Todo it you have to select "Use installed network card" checkbox and select the card from the list. after that you can use the workstation ip.
This was helpful for me:
Windows Virtual PC and the Microsoft Device Emulator
I've had to use it more than a couple of times.
I saved the file as a PDF to my network folder, so it took me a while to find the link.

QT - qtwebsocket - can't connect

I'm using qtwebsocket from https://github.com/antlafarge/QtWebsocket on QT Creator 5.0, Linux 64bit. I'm trying connect to echo test:
wsSocket->connectToHost( "echo.websocket.org", 80 );
But I immediately get disconnected status. I tried also with ws:// and http:// prefix but same error. Any idea? I even don't know how to report a bug on this gitorious.
It is important to me to don't use webkit, I need pure TCP socket connection.
Regards
There is also a Qt websockets add-on module located at https://qt.gitorious.org/qt/qtwebsockets.
It has been tested on several platforms, and successfully succeeds with the AutoBahn Testsuite.
Just quickly looking at the example located:
https://github.com/antlafarge/QtWebsocket/tree/master/Example
I don't know the state of the project too well, but it looks like there is still a to-do list on what it can do; one item I noticed, it says WSS is not yet supported.
Try running both sides of the Client and Server in the included example, and see if you can get a connection in that context before trying the echo.websocket.org server.
Hope that helps.

Sysinternals' Portmon: Error 2

When I try to connect to local ports, Computer -> Connect local, using Portmon v. 3.02, I'm getting an error message, Error 2, in a small error dialog box:
I run the tool as an administrator (if not, I get error 6).
By the way this is a Windows 7 x64. On 32-bit, in Windows 7 x86, it works fine. How can I fix this problem?
Sysinternals' Portmon works only on 32-bit versions of Windows. It does not support 64-bit (probably its driver is not signed).
From the Portmon homepage:
Runs on:
Client: Windows XP (32-bit) and higher (32-bit).
Server: Windows Server 2003 (32-bit) and higher (32-bit).
In Windows Explorer, right click on portmon.exe --> select Properties --> click the Compatibility tab, and Run in Windows XP compatibility mode. It works fine like that in Windows 7 64-bit.
"Error 2" is "Cannot find the file specified", that is, cannot find a required DLL file.
Originally, you got this error when you tried to run Portmon from a network location: that broke the security trust, causing Portmon to be untrusted (or perhaps just messing up the search path somehow).
On my copy of Windows 7 64 bit, Microsoft Dependency Walker (depends.exe) tells me that PORTMSYS.SYS (the file created/loaded by Portmon.exe), has unresolved dependencies on ci.dll, clfs.sys, hal.dll and kdcom.dll.
Those are the
code integrity
common log file system
hardware abstraction layer
kernel debugger com
libraries, and they aren't actually missing: if they were, Windows wouldn't boot. However, I don't see a copy of those files in SysWow64. This suggests to me that the problem is not with portman.sys: the problem is with the win32 compatibility layer in Windows 7/64 bit: It doesn't support debug properly.
It is now 2018. There is no 64-bit version of Portmon. Serial ports are a legacy standard. The Windows 7 problem was fixed by the release of Windows 8.1. However, there is a faint chance that some Visual Studio utility or security update back-ported to Windows 7 will fix the problem. Perhaps someone who is familiar with SysWow and debugging will comment.
Instead of portmon for Windows x64, you can use an emulator of a pair of virtual COM ports and a simple program that will connect the physical port and one of the virtual ones, as well as perform the logging function.
To create a pair of virtual COM ports you can use:
com0com (preferably version "com0com-2.2.2.0-x64-fre-signed", because it contains signed x64 driver)
Virtual Serial Ports Emulator (VSPE), every time it starts on x64 it asks to purchase a driver, but it works even if you refuse.
Simple mapping and logging program can be found e.g. here or you can write it yourself, it is simple.
The sequence of actions is follows:
Сreate a pair of virtual COM ports using emulator (for example, COM28 and COM29)
Let the external device be connected to the computer COM1 port. In the program, whose exchange with external device we want to listen to, we set up a port COM28 (instead of СОМ1) for communication.
In the mapping program, we set up that we want to bind and log ports COM1 and COM29 (don't forget to set the port baud rate).
I haven't tried it yet, but this question mentions com0com. It creates two virtual serial ports and emulates a null modem cable between them. It claims to be able to run on 64 bit Windows. I'm not sure whether it comes with software that lets you just pipe input from a real port into one of the virtual ports. One of the FAQ's says that you can turn on logging.
I guess in the worst case, you could write your own small program that pipes data from a real port to one of the virtual ports and logs it all.
There's also this question on open-source alternatives that mentions a couple of projects.
I've used AccessPort
http://sudt.com/en/ap/download.htm and it works great. Very similar to Portmon
Don't start Portmon from a network drive/path or something else.
Copy on to the hard disk drive, e.g. on the desktop, restart and try again!
If you run Portmon in compatibility mode, it will work.
Check Make older programs run in this version of Windows.
It says:
To run the Program Compatibility troubleshooter:
Open the Program Compatibility troubleshooter by clicking the Start button Picture of the Start button, and then clicking Control Panel. In the search box, type troubleshooter, and then click Troubleshooting. Under Programs, click Run programs made for previous versions of Windows.
Follow the instructions in the troubleshooter.
The above is a public explanation from Microsoft for a common situation when running older applications in Windows.
But, I can say it briefly;
Right click on portmon.exe
Select menu about "troubleshooting compatibility problem" or something like that (I'm using a foreign version of Windows, so I don't see correct name of that menu in English.)
Select automatic mode
It will detect the problem and recommend Windows XP (SP2) mode
Select it and execute Portmon again.
I hope it works!
Instead of Portmon you can also use the IO Ninja program with the "Serial Monitor" plugin.
It gives a little less information than Portmon, but in a more understandable form. The main thing is, just like a Portmon, it allows you to see the data that is transmitted between a third-party application and an external device via a serial port. The program works under modern versions of Windows (I tried it myself on Windows 10 x64). The aforementioned plugin "Serial Monitor" is paid (but has an evaluation period).
Note: the port that you want to monitor must first be connected to the "IO Ninja" program, and then opened in a third-party application whose exchange with an external device you want to track.
Just to test that the hardware is working, you could perhaps boot a Linux live CD and run the statserial and/or minicom program to verify that it works. The Knoppix distribution seems to contain both those programs.
Serial ports on Linux are named /dev/ttyS0 for COM1, /dev/ttyS1 for COM2, etc.

Resources