I'm maintaining an enterprise C# application that provides end-user extensibility through user-defined JavaScript functions (with a select few C# types/proxies exposed) (think financial algorithms).
We evaluate those functions using ClearScript (prevously we were using another library called Noesis however we've moved away from that).
I'd like to offer a way for end-users to perform very basic debugging of the scripts (through a web interface). At a minimum - inspect variables and step over/into functions.
I've successfully connected to the ClearScript engine w/ Chrome when running the app locally and have been able to step through the scripts - however I don't think the same would make sense for end users whilst running in production for various reasons:
Might be too tricky for them to set up
Possible difficulties with port allocation
Probable firewall issues
What I'd really like is a SignalR interface to the V8 debugger - the web-app would interact with the SignalR, and SignalR would interact with the V8 debugger.
Has anyone done something along these lines before?
Are there any relevant .NET libraries I should be looking at?
Am I right in my thoughts that this seems like a fairly big piece of work?
Any other advice?
It's a web-socket based protocol - though you must make a request via HTTP to retrieve the tabId first (request to /json/list)
https://chromedevtools.github.io/devtools-protocol/1-2/Debugger describes the protocol - there are different revisions targetting different versions of Chrome but 1.2 (stable) seems to work w/ the version of ClearScript I used.
As well as request-response (command) type interactions on the websocket, V8 will also publish events - e.g. Debugger.scriptParsed & Debugger.paused on the same socket.
Some of the key commands:
Runtime.enable
Debugger.enable
Runtime.runIfWaitingForDebugger
Debugger.getScriptSource
Debugger.resume
Debugger.evaluateOnCallFrame
Runtime.getProperties
I've written a small demo project https://github.com/flakey-bit/ClearScriptDebugging/ that shows a target process being debugged by another process.
If you mentioned Chrome and Nodejs, You maybe know that Nodejs, Chrome and Edge support WebSocket naturally. Chrome and Edge better with all security options. For Nodejs you can find standard libraries like socket.io
For the server side DotNet WebSocket
WebSocket protocol is linga franka today.
Related
There's been a lot of news lately about the HTTP/2 standard, very similar to Google's SPDY.
It seems like most modern browsers support much of the functionality the finalized HTTP/2 draft lays out (see here, for example).
But, from the viewpoint of server side coding using ASP.NET and IIS, it's difficult to find much information from Microsoft about how this standard will be used in the .NET framework, especially with ASP.NET (see here).
What options are available for incorporating the technologies available through HTTP/2, in a solution currently using .NET framework 4 or above?
Also, has anyone found any news from Microsoft about if the System.Net namespaces and classes will be updated?
Sorry for the basic question formats - I'm new to web development, and just want to make sure I stay on track of new and emerging technologies.
2016-07-21:
HTTP/2 requires Windows 10 or Windows Server 2016 on the server side. Those operating systems ship with IIS 10. So far IIS 10 has not been made available for installation on older operating systems. Given past behavior it is unlikely it ever will become available on downlevel operating systems.
With SSL enabled (which is a requirement of the HTTP/2 protocol), IISExpress on Windows 10 will begin interacting with the browser using the updated protocol.
(https://weblogs.asp.net/scottgu/released-today-visual-studio-2015-asp-net-4-6-asp-net-5-ef-7-previews)
Given that HTTP/2 does not change any of the HTTP semantics I do not expect applications to do anything special to make use of that. It should work with any .NET version and any framework. I have not tried it, though.
February 2015:
For now you need a proxy server in front of IIS. Or a CDN which does HTTP 2. I expect all major ones to very quickly support it given that all browsers already support it.
The Win10 version of IIS will support HTTP 2 according to currently available Microsoft information.
I'm pretty sure the network BCL classes will be updated eventually given how much steam is behind HTTP 2. All clients and servers seem to be willing to support it very quickly.
I am given a project where we want to develop a POS based web application using asp.net.
I have already looked at POS for net and its a wel-known fact that due framework changes, POS.net needs some config file setting changes. My target framework is 4.5, and so far I don't know how many more libraries are depreciated.
I tried to create some sample applications for Proof-of-concept, I tired ActiveX components, SL4/5 applications to read client machine's COM ports. Since its a development env, I even tried accessing webserver's COM ports.
These applications have their own drawbacks. I also want to mention that since the development is under controlled environment, security settings( for ActiveX) isn't a issue.
1) Using ActiveX restricts the client machines to Windows OS. There is an option to created browser plugins using NAPI, but I couldn't get further with it as it has its own learning curve and the programming is in pyton.
2) Silverlight OOB( out of browser) application seemed promising, but the sample from
codeplex didn't work in all scenarios
Am I missing out on something?
Please note I have already studied WSPOS implementation.
So far the applications which we have seen that can access client machine's COM ports download a JAR file. The team is finally at a stage where they are concluding that this can be done using JAVA and not C#/.net.
Please let me know what basic point I am missing.
How much control do you have over the client machine? You could write a Windows Service that your web server would interface with. You would just have to know what terminal your user is logged in from.
I am looking for an embedded Web Server with out of the box SSL support, preferably configured from a command line or some easy config, without the need to change system wide config (like Registry). It should also work on mono.
Have you tried my old server http://webserver.codeplex.com? It supports SSL and at least used to run on MONO.
I'm also (slowly) building a new one, it got no SSL support yet (but's not that hard to implement by yourself): http://github.com/jgauffin/griffin.webserver
Edit
The HttpListener in Griffin.Framework have SSL support now
I recently came across two such packages.
ceenhttpd - https://github.com/kenkendk/ceenhttpd
and
uHttpSharp - https://github.com/Code-Sharp/uHttpSharp
The part i like about these is that both of them let you load a certificate file from disk. If you use the raw HtttpListener, that is a pain.
If you are open to use .NET Core, you can also self-host Kesterel. I plan to use this as soon as I convert my projects to .NET 5. here is a small sample code for that.
I'm not sure where to get started with simply executing a remote script and returning the output to a web form. In this case we have an application server that executes some 3rd party tools. We'd like to write an interface for our power users that allow them to check the status of various processes and also execute some of the 3rd party admin tools that support has available. The issue is that we only connect to this Linux (RedHat) machine via Putty over SSH. I looked into PsExec but it doesn't seem to handle SSH. I'd like to avoid any large security holes, if possible, but this is intended to be a limited number of users in a closed network.
Thanks for any assistance getting started!
There are several options to do SSH in .NET - although you need a library for that since nothing is built-in:
http://www.codeproject.com/KB/IP/sharpssh.aspx
http://www.rebex.net/ssh-shell.net/ (commercial)
https://www.eldos.com/sbb/net-ssh.php (commercial)
http://sshnet.codeplex.com/
http://granados.sourceforge.net/
I would like to embed a light weight web server in a Windows application developed in .NET. The web server has to support PHP.
I have looked at Cassini, but it seems it is ASP.NET only.
The .net class HttpListener exposes the underlying http.sys upon which IIS is built. All machines since Windows XP2 have http.sys installed by default.
Here are some links to get you started.
XML-RPC SERVER USING HTTPLISTENER
HttpListener For Dummies
As for the PHP support, I don't know how you would enable this, but there is no technical reason you couldn't build it in.
I would look at the likes of XAMPP Lite which you could easily start up and shutdown with your application.
There is also AppWeb which claims to be exactly what you are looking for.
You can always use PHP as a CGI application. CGI is well documented, and AFAIK pretty easy to implement. Use Darrel Millers suggestion, and couple it with some CGI magick, and you should be cooking with gas.
Mongoose embedded webserver
https://code.google.com/p/mongoose/
You can build it with VS2012/10/08 as EXE and you can use PHP and also websockets to push data to the client app. Also you can build a DLL you can do this with make or bring the code into a VS DLL project and build out a _DLLMain, DEF file, etc. Then use it direct from C# - see the mongoose.cs and example.cs files.