I have a javascript code (business logic) runs on client side, i want the same logic to execute from windows service (C# code), instead of re-writing those complex javascript code to C#, is there any way to execute it from C# class itself. Because i want to run this code inside windows service
-
Do you want to simulate a web browser and run your JavaScript on it? If yes, the Selenium framework might be a good choiceJakub Loksa– Jakub Loksa2016-08-04 16:58:44 +00:00Commented Aug 4, 2016 at 16:58
-
No, for example, in javascript i have a different functions which takes the Json data and does lots of business validation and extracts result out of it and dumps into database using REST service, i need the same logig to extract result from json input to run on windows service(scheduled one). Moving this javascript logic to C# will take lots of time and effort for testing. so i'm thinking any is there quick way without re-writing those code in C#, just execute and store the result in dbMathiyazhagan– Mathiyazhagan2016-08-04 17:05:29 +00:00Commented Aug 4, 2016 at 17:05
-
rushfrisby.com/which-net-javascript-engine-is-the-fastest or stackoverflow.com/questions/172753/… may be a starting point... Note that if your JavaScript was not written to run without browser rewriting code in C# may be faster option...Alexei Levenkov– Alexei Levenkov2016-08-04 17:13:03 +00:00Commented Aug 4, 2016 at 17:13
Add a comment
|
1 Answer
In theory, yes, you can. MicroSoft has released the JS engine behind the Edge browser - Chakra. You can find it on GitHub.
1 Comment
Bozhidar Stoyneff
@AlexeiLevenkov: "write one from scratch" - what do you mean? It is already written and you can execute scripts directly...