I have to call a method of a complex .dll C# library when I get a "request". Since I don't want to program the network part (socket, protocol, etc.), I'm thinking of using an existing Web server (IIS or Apache) to handle this part (and use HTTP as protocol).
It has to be very scalable, and the .dll library uses the .NET Framework.
Of course I'm thinking of exec
function in PHP, but this would start a C# program again and again for each single request, which is not very good. I would like to load the C# .dll once in memory, and have it running on the web server directly if possible, so that only "calls" to a method happen when I get a specific HTTP request.
My question has similarities to this one, however I don't believe our problems are the same.
Is it possible to load the .dll in memory and call a method of it from a web server? How to do it?
Yes, for example by programming a service layer around it using WCF or the ASP.NET Web API. Given the quirky (to say the least) interoperation of SOAP services and clients, I'd go with the latter.
You can then call your SOAP/REST/giveitaname service through PHP's cURL or any other applicable method, and your C# service will then call the code in the DLL (this part you'll have to build).
You can host both types of project easily in IIS, making it accessible through HTTP.