Call C++ DLL function through nodejs web API - node.js

I wrote a C# dll file with functions that return some values. I am trying to call dll functions through node.js web Api to get some return values. But I don't get Any proper information on how I can do this.
example.com/getinfo
Please support how i can do this.

You will need to register the dll file. The file on example.com needs to be allowed in your configuration of your web server. It also may need to be in the right location/folder to be accessed and have the correct rights to execute. It would help if you mentioned what kind of server is serving web pages. Apache - IIS etc.

Related

isapi dll force download

I have a legacy ISAPI dll, that generally fulfills requests just fine, but occasionally I will get prompted to save the dll from my browser. This is a known issue, with some good workarounds. IIS 8.5 serving dll for download instead of executing Hitting download will give you a zero byte file.
I am actually interested in doing the opposite of the workaround. How can I force this (incorrect) behavior, ie, is it possible to trick the server to download the full ISAPI dll? If so, what settings should I change. I am running IIS 7.5.
[EDIT] For clarity, I am not trying to hack anything client side. I doubt that's possible, but if it is I would really like to know. I am trying to figure out if it is possible to get the server to give up the dll with just a plain old post/get request. This is how I got it to give me the dll the first time, luckily it was zero bytes.
Thank you

Request.ServerVariables("HTTP_EMPID"). Is this CUSTOM (Warning: Classic ASP)

I suddenly have to support a Classic ASP web app (yes, I know it's older than dirt).
I am using VS2017 to attach a debugger and debug it. When I debug the code I notice that the code appears to depend on the following variable being set
Request.ServerVariables("HTTP_EMPID")
and I don't see where this is set anywhere. Usually, I expect server variables to be read only and provided by IIS but this looks like a custom variable and is not in this list
https://www.w3schools.com/asp/coll_servervariables.asp
I don't have access to the web server. Is it somehow possible to configure a web site to populate this variable perhaps via an applet or some other means? If I could trace debug this code this would help me tremendously and this is one obstacle.

Server-side file system browser

I am creating a node.js web interface for an internal project in the company I am working at. The web page should allow users to select a file that is in the server memory disk for processing. I want to do something like a file browser but for the server-side file system.
I tried implementing it with jqueryfiletree but was not successful since I can not seem to put it to work. Is there any cheap trick or an useful package to do this?
Thank you in advance.
Using node.js you can get all files names in folder, using the fuction fs.readdir(). After that you can read file by name fs.readfile() and send him on client by http.
I think this is simplest solution.

Run DLL on Azure Cloud Service

I've worked a lot with Azure websites but not cloud services. I need to spin up a cloud service that uses a third party dll to generate pdfs (http://wkhtmltopdf.org/). However, I would like to write this server in nodejs and almost all examples are in asp.net. I just need to know how to reference and execute this dll (or exe, if that's easier) from node js in an Azure Web Role when a request comes in. I'd greatly appreciate any pointers.
Thanks,
Sam
EDIT: It's not necessarily a matter of referencing or using the dll from the code that I will have an issue with. It's how to INSTALL the dll on an Azure web role. All you can do in an Azure cloud service / web role is upload the project package but no explanation on how to add a dll or exe (except in asp.net, which I am not using. I'm using nodejs).
You can put the installer in your web role package, and set up a startup task in the ServiceDefinition.csdef file for the roles.
Here is the sample on official site Install .NET on a Cloud Service Role, which is guiding to install .NET in Cloud service, the steps and scenario should be the same.
There are a lot of wrappers for wkhtmltopdf. This one is nice and pipable (you can stream the output directly to your client):
var wkhtmltopdf = require('wkhtmltopdf');
// URL
wkhtmltopdf('http://google.com/', { pageSize: 'letter' })
.pipe(fs.createWriteStream('out.pdf'));
// HTML
wkhtmltopdf('<h1>Test</h1><p>Hello world</p>')
.pipe(res);
You have to install wkhtmltopdf (the command line tool) first of course.
Assuming that the dll is a managed assembly (i.e. an assembly compiled using .net), you can use edge.js to get NodeJS to interact with the dll.
If it is an exe, you can execute the process via NodeJS's asynchronous process creation API.

Using log4net in a complex software

I'm using log4net logging in my software that consists of several applications.
I want to have one common library for this.
I created a library and put it in the conficuration file. In AssemblyInfo.cs placed attribute:
log4net.Config.XmlConfigurator(ConfigFile = #"c:\logging.xml", Watch = true)
It work for windows service, but in dosn't work for asp.net application.
It work in asp.net if delete attribute from common library and put in into global.asax. However, this leads to that section of the log4net configuration must be made in the windows service.
There is also a business process which causes our library through the
remouting. I want the logging was carried out there too.
Is there way around this?
In my opinion the library should not define where the configuration file is found. Maybe a better idea would be to have a helper method that allows you to configure log4net quickly; that method would take an optional parameter for the config file path and would try to load the configuration file from the specified path first and if that does not work fallback to some maybe the current folder, the application folder or even the web / app.config.
If you insist that it must be an absolute path then you need to give the IIS Application Pool user read access to this file. This way the configuration by attribute should work for services and ASP.Net applications. I do not understand what you mean by "remounting".

Resources