question

Timmy-5267 avatar image
0 Votes"
Timmy-5267 asked Timmy-5267 edited

How to pass and revieve variables from dll to web server

How to pass and revieve variables from dll to web server

I am fairly new at programming, especially with .NET so please bear with me. I am trying to create a .NET .dll file that passes some floating point and string variables to a private server to perform sensitive calculations and algorithms. Then I would like the private server to pass back some output variables to the dll, and the dll finishes the rest of the calculations which are less sensitive.

What's the simplest way to approach this and what libraries/packages are needed? How do I ensure the dll waits to receive the server's output before continuing further calculations?

Thanks

dotnet-aspnet-core-generaldotnet-aspnet-generaldotnet-standard
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

AlbertKallal-4360 avatar image
0 Votes"
AlbertKallal-4360 answered Timmy-5267 edited

Ok, we going to need more context.

to create a .NET .dll file that passes some floating point and string variables to a private server to perform sensitive calculations and algorithms.

Ok, is this .dll for the desktop program, or where/when how do you want to use this .dll? The .dll library code has to be used and exist in some context.

In other words, do you want the web site to use + consume and interface to that .dll? (and in this context that would mean it is some kind of .net assembly).

So can the web site use + consume + interact with that .dll? yes, it most certainly can.

However, the next question then is what kind of client software are you meaning to use here?

Is the client software a desktop program?

Is the client software maybe a web browser?

And we might need more details as to what kind of .dll you are talking about here?

But in general, the answer is yes if you need/want/expect the web site to consume + use that .dll

You would as a general rule create a web service on the web site, and the client software (which we don't know what you plan to use) can then pass values to the web site. The web site can then take those values, process them with that .dll, and then return the results to the client side.

So, the main remain questions are:

What kind of .dll is this?
(it is a .net .dll, or some 3rd party code). If it is NOT a .net .dll, then it can be used, but in most cases it would have to be a x64 bit .dll if this is to be hosted on the web site.

And next, we need to know what client side software you want to use to interact with the web site that has use of that .dll.

Perhaps you mean a desktop program, or maybe you mean a browser based client? (but, both a web browser, and a desktop program are able to talk to the web server which has that one .dll you wish to use.

For example, I use GhostScript .dll on one web site. It is a .dll, and I am able thus to convert a up-load PDF file to a image thumb nail for display on the site. The client side software in this example is a regular plane jane web browser.

so, in most cases, you would build a web service on the web site, but, that may well not be required if the client side software is to be a browser - in that case? If the .dll is a .net one, or even not, the .net code on the web site can interact with that .dll if need be.

As long as that .dll is a standard windows .dll, then you can do this. If it is a .net assembly .dll, then for sure you can do this. But, even non .net .dll's can in most cases be consumed and used by the web site. However, for non .net ones, then you REALLY want to have a x64 bit version of that .dll.


Regards,
Albert D. Kallal (Access MVP 2003-2017)
Edmonton, Alberta Canada

· 6
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Sorry for the late response. Let me clarify. There are no web sites involved. I have a desktop application that allows for custom programming in C# and can use external libraries. I want to write a certain custom algorithm within this desktop app. However I don't want my source code to be on the same PC. Hence I must somehow pass relevant variables (and maybe even methods/classes) to my other server to actually perform the algorithm, then pass the results back to the application. Now the issue is that the algorithm requires the application's specific namespace and methods, so passing these directly to a web server may be difficult (SignalR's invoke?). Currently I am studying SignalR for this reason, or I could maybe just perform a part of the algorithm on the server side which doesn't require the application's namespace. Either way, I still need a way for both sides to communicate, in a fairly easily implementable way as I'm not an experienced programmer. Some example code to study would be nice too.

0 Votes 0 ·

Ok, well, you could still consider a web service. But then again, that would require that you have a whole server running IIS (internet information services "web server".

in other words, what resources and what type of server system do you have available for those desktop programs to talk to?

Is this say a company network, or are we talking about a desktop program that runs anywhere, and any time and any place - and is to connect to some web base server?

or is this software to be run on a typical office LAN (local area network), and then you say want your code on some server?

I mean, obviously the most simple would be to write + create that .dll as a .net class and simply include it in your project, and then deploy that .dll along with the rest of the project.. Of course the downfall would be that most .net .dll's can be reversed or de-compiled . (but, I suppose you could try one of the code onsficators that claim to prevent this from being possible.

So, when you say "some server", that is a rather huge wide open array of possible choices?

So, as noted, you could still build a web service - but that might be a big tall order if you don't have a web server up and running at your disposal in which you can then write + build the web service in asp.net to run on that web server.

Last but not least? I suppose you could put the code on a standard windows server and use a PRC (remote procedure call). but in such cases, that would still mean the .dll is sitting on your network, and exposed.


0 Votes 0 ·

Yes, dll is an option but it can be decompiled hence why I have to try going through web. What server system do I have? The main application will be running on windows server 2012 and I want it to communicate with a hyper-V running another instance of windows server, but with a different IP address as my hosting provider provides multiple IP addresses for the same bare metal server (not sure if this would actually work). That way I don't have to rent a second server. The desktop program (running on my original server/workstation) connects to the internet to fetch data, and my custom algorithm will process the data in real time (on a second server/workstation), so you can see why I need to use their namespace and methods as a part of my calculations. I have not read much about IIS so I'll have to look into it. What methods/classes would I use here? All I've been studying is SignalR.

edit: whether I use a dll or not doesn't really matter as the application's built-in IDE can call on external namespaces and stuff with "using". What really matters is my sensitive code needs to be run remotely

0 Votes 0 ·
Show more comments