Send commands from lighttpd to mono application - mono

I'm working on a project and what I want to do, I have installed lighttpd on my raspberry pi which is running xbian and I have created asp file using to control xbmc by using some .net library.I got mono application as well to control xbmc and I want to send command or signal or message from lighttpd to the running mono application
How to do this, do i have to use any rpc, pipe etc.
thank you

You could either use the lua or php plugin, parse the requests there and run your stuff accordingly.
A rather difficult alternative would be to write a plugin yourself and make that do whatever it needs to do (though this will require at least decent C skills as well as security awareness) http://redmine.lighttpd.net/projects/1/wiki/HowToWriteALighttpdPlugin

https://www.mono-project.com/docs/web/fastcgi/
Separately, if files are downloading instead of being processed, then ensure that you have configured lighttpd.conf mimetype.assign

Related

How to code vb.net for website? I want the UI embedded within the web page of my browser

I have made an exe program using vb.net but I want to make a webpage on which that exe is embedded.
Like the way this site has done.
You already have the source code for your VB.NET application, the path of least resistance is to factor out the desired functionality into a library DLL. Your web server presumably runs Windows and so will probably have ASP.NET capability. Just reference the DLL in your ASP.NET project and call into that instead.
My advice is don't make a rod for your own back by creating your own CGI binaries:
With a CGI application you'll have to generate all of the response headers and markup by yourself, you'll also have to parse any inbound headers, cookies etc yourself. It's a lot of work to replicate functionality already present in ASP.NET
Enabling CGI executables on your web server increases the risk of a security compromise, either through a mistake in your VB.NET executable, or because via some other vector an attacker has been able to upload a malicious executable and run that.

How to implement working web server with Mono WebAPI application

Mono 3.2 MVC4 WebAPI application is running in Debian x64 VPS server. Mono is compiled from source and 4.5 subtree is used.
Application requires Chrome or Safari browser.
After refreshing browser window several times server does not work properly. I tried all known free possibilites:
Apache + mod_mono
After pressing browser refresh button several times server randomly returns 500 error for some pages
and apache error log contains "failed to map path" exception.
I posted it in
https://stackoverflow.com/questions/20356779/how-to-fix-failed-to-map-path-errors-in-mono-mvc4-application
and in
Mono ASP.NET mailing list without any response.
There are number of mono applications in server, maybe mod_mono selects wrong thread or is there some bug in webapi mapping implementation in mono.
Nginx + mono-fastcgi-server4.exe
Holding down F5 key causes 200% CPU usage forever in mono-fastcgi-server4.exe
I posted it in
https://stackoverflow.com/questions/20512978/how-to-limit-mono-197-cpu-usage-in-mono-fastcgi-server
and in
Mono ASP.NET mailing list without any solution.
Is looks like there is bug in mono fastcgi server or it is not compatible with mono 3.2
Using xsp4.exe directly
It causes "server does not return data" in Chrome if browser window is refreshed several times.
I posted this in
https://code.google.com/p/chromium/issues/detail?id=329311
without response.
Maybe xsp4 does not implement http protocol properly.
Havent tried ServiceStack since it cannot used for closed source development which is required. Also application uses also images, css, js files and MVC views which needs also served.
How to create proper server for mono which returns correct data ?
When 500 errors happen, somewhere in the mono class libraries an exception was thrown, you can find out more by using tracing:
mono --trace=E:System.Exception YourApp.exe
This way it's very possible that you find out what is causing the load problems you're seeing in each case (to do this for mono-fastcgi, you would need to add the trace argument in the script that calls mono-fastcgi-server4.exe).

Does Mono have a hot swapping feature?

When I code in Java, I can use tools like JRebel to allow me to see changes immediately without restarting the server. (I'm embedding the JVM into a c application, so I don't want to constantly restart the c application for every Java source code change)
Does Mono have something similar?
You can do something similar by using application domains (load the new code in a new appdomain, unload the old one etc).

Is there a decent, standalone, cross-platform webserver that will work in concert with Autorun on USB Jump Drives?

I'm trying to find a decent standalone webserver that I can load up on a jump drive.
My wife is a photographer, and I'd like to present the clients with their images on usb. When they plug it in, I'd like a web page to load up, and run some jQuery magic to show them a nice carousel of all there images.
So far, this is all fine since it can all be done client side and doesn't need a server at all.
The problem I'm facing is that I'd like some server-side code to be able to read the images out of the directory so that once the interface is built, I don't need to manually create all of the <img /> tags.
If it was primarily going to be used in a Windows environment, I'd have no problem going with IIS Express, since I'm mainly a .NET MVC developer and this would be perfect for me... However, the fact of the matter is that a large amount of our client base is also OS X users.
I did find this Java one jlHttp, and I also found this thread here on SO, but I don't think I understand enough about either one of them to accomplish what I'm looking for.
Thanks in advance for your suggestions.
I'm looking for the same thing, and the two best options I've found were Flying Ant cd web server and Stunnix. Of the two, Flying Ant is cheaper, and I've tested it with success on my project.
I found Mongoose very convenient for this exact purpose. It's crossplatform, lightweight and requires minimum configuration. You may be interested in this project that uses Mongoose to display pictures in a folder tree or FTP directory.
How about Node.js
It says it runs on Linux, OS X, and Windows.

How would I created a flexible EC2 Windows 2008 boot script?

If you look at the Linux ecosystem (especially the Ubuntu and Alestic EC2 images) there is a common technique where the VMs are pre-configured to look at the EC2 user-data and use it as a boot script. The nice thing about this approach is that you can write a boot script that further provisions your machine, allowing you to avoid making a new image every time your software that runs on the machine changes.
I want to do the same thing for Windows, but given that I'm an Mac and Linux guy, I'm a bit lost on where to start. My requirements are:
This must run on Windows Server 2008
A bootstrap script needs to start when the machine boots up, read the user-data file by pulling down the contents http://169.254.169.254/1.0/user-data
The bootstap script then needs to run the contents of that file as if it were a script
The script embedded in the user-data needs to run in such a way that it has access to the desktop environment (ie: it can launch a browser, etc).
I'm not quite sure how services work in Windows or if I need to enable auto-login, so any advice here would be appreciated. The ultimate goal is to run a Java program that launches some custom software that in turn launches a web browser (IE, Firefox, etc) and is capable of taking screenshots.
The screenshot part is interesting, because in the past when I've tried this the only way I could get something other than a black screen was to have UltraVNC or RealVNC boot up as a service, though I don't know why that helped.
I'm looking for answers to three specific questions, as well as any general advice:
Should I be focussing on a Windows service or auto-login + bat file in the "Startup" folder?
If I use a Windows service, is there anything special that I need to do to make sure desktop access and/or screenshots are available?
Do you recommend any tools for common Linux commands, like curl or wget? Last time I used Windows I used Cygwin a lot, but is there something more appropriate to use here?
I have not tried auto-login on Windows instances in EC2, but here's the support document on how to enable it.
We boot-strap our Windows instances using a custom AMI with a custom Windows 'install' service already installed. The boot-strap installer reads a URL from user-data at startup. The URL points to a ZIP file stored in S3. The installer then downloads, un-zips, and executes the actual application installer -- in our case a simple CMD fie.
This setups allows us to have one base AMI and then be able to easily overlay 15+ different application configurations (without having to rebuild the AMI). If you only have one application configuration this may be overkill for your situation.
The only trouble we ran into was having our installer service start to early -- changing the service startup mode to "Automatic Delayed" fixed that issue.
We wrote our boot-strap installer in Java, launched via YAJSW, because we're comfortable with it. If you just want a few simple Unix tools, most are available pre-compiled for Windows, for example wget.
For something completely different, you could try PsExec to configure the instance after it has booted.
You can try using RightScale's free developer account to create plain Powershell scripts and associate them with your Windows instances to run at boot time. The RightScale dashboard solves exactly the problems you are trying to solve above.
DISCLAIMER: I work for RightScale.
As for screen capture CutyCapt is a simple tool you can point at a URL and generate an image from.
Unxutils is a great solution for those looking for unix tools on Windows. It's got the wget.exe that you're looking for, however, using Powershell to download stuff is not so bad either:
$wc = new-object system.net.webclient
$wc.DownloadFile("http://stackoverflow.com","test.html")
If you can write a batch file to do your setup, then you can run it at startup of the vm by doing this:
1. Run REGEDT32.EXE.
2. Modify the following value within HKEY_CURRENT_USER:
Software\Microsoft\Windows NT\CurrentVersion\Winlogon\ParseAutoexec
1 = autoexec.bat is parsed
0 = autoexec.bat is not parsed
As an answer to #3, I would say that you can do just about anything in a batch file that you need which includes downloading from a ftp server (but not from a http server). I am really interested in this stuff and so if you have questions, try asking me.
If you use Elastic Beanstalks you can use this:
Customizing the Software on EC2 Instances Running Windows
It uses YAML formatting standards, e.g.
packages:
msi:
mysql: http://dev.mysql.com/get/Downloads/Connector-Net/mysql-connector-net-6.6.5.msi/from/http://cdn.mysql.com/
or
sources:
"c:/myproject/myapp": http://s3.amazonaws.com/mybucket/myobject.zip
I know this is a little bit late to help out with the original post but for anyone who is still reading this one solution is to use the http://cloudinitnet.codeplex.com/ project. The service is easily installed using a powershell script and will create a local administrator account to use while running.
The goal for this project was to replace the Cloud-Init project used in Amazon Linux and Ubuntu.