0

One asp.net application I am writing must serve a pdf file and an drawing (dxf AutoCAD file) both created with a Delphi program.

Just to clarify the scenario: I have skilled Delphi developers so I assigned them the task to create the programs who create the pdf and the dxf file.

So there is a total of 3 systems:

1) an asp.net Main application

2) a Delphi application which recieves some parameters (from asp.net) and genreates a pdf file.

3) a Delphi application which recieves some parameters (from asp.net) and genreates a dxf file.

Now the Delphi applications as standalone win32 applications (in which the parmeters are set through UI controls) work both fine and i need to convert them so that they can be used from asp.net.

I am not interested in concurrency/performance issues, my goal is just to call the "part of the system that creates a file" so that I can let the enduser of the asp.net application download it. I can also accept that this is out of threads (I mean: only one user can call in background one of the Delphi applciations at a time)

Could you please suggest the best approach for this?

Before starting this proejct I had in mind "dll" or "command line exe" but now i am in doubt and wonder that may be i am missing some more convenient technique.

Please consider that porting to c# the libraries it is not an option since we used some 3rd party Delphi components that have no a 100% .net counterpart.

5
  • 1
    i do not understand the negative vote. Please explain it with a comment. I googled a lot before asking. Commented Feb 4, 2017 at 16:00
  • I'd guess your question is too broad, since you're actually asking for suggestions (Could you please suggest...). It's like coming here and asking "How can I integrate with Google Maps API". Even though you googled a lot, you haven't posted what you've tried so far, didn't show a code sample. Commented Feb 4, 2017 at 16:29
  • 1
    Anyway, if I was to answer it, I'd suggest your C# app to create a .txt or .xml containing the parameters in some folder, the Delphi app would have a mechanism (like a Timer) to eventually scan that folder and process the request, C# app would wait until the pdf was avaible in another (or the same) folder. You might want to create another folder for your other type of request. Also, I'd try to create these Delphi apps as windows services, it looks they actually doesn't need an UI. Commented Feb 4, 2017 at 16:36
  • It's way too broad and opinion based. Sorry, not a fit for this site Commented Feb 4, 2017 at 16:57
  • 1
    @Alisson the solution you suggested with TTimer and a text file is smart and i can consider it too. In simple cases like this one I use NSSM to quickly convert a standalone exe into a Windows Service. Commented Feb 5, 2017 at 13:47

1 Answer 1

4

Years ago (around the Delphi 8 timeframe), there was an actual Delphi.NET compiler that could produce .NET assemblies that run in ASP.NET (my own website still runs today on some ASP.NET assemblies I wrote with Delphi.NET), and even use Delphi as a scripting language in ASP.NET coding. But Delphi.NET is now a dead product and .NET is no longer a supported platform by any modern Delphi compiler.

So, if you want to run Delphi code in ASP.NET, you are going to have to either:

  1. Write a plain DLL and install it into your site's \bin folder, and then access it using PInvoke.

  2. Write a COM object and install it on the server machine, and then access it using COM interop (see the Server.CreateObject() method).

  3. port your code to another compiler that supports native .NET development.

Sign up to request clarification or add additional context in comments.

4 Comments

You can expose the code as a COM object. Or expose it as a Win32 dll and consume it using pinvoke. This answer is thus factually incorrect.
Thank you. Pinovke sounds good. Another smart solution is to use the standalone exe (with timer approach described in the comments of the question) installed with NSSM
I suggested the timer approach because it was the simplest solution I could think. If I was to use the suggestions given by @RemyLebeau I'd have to do some reasearch, since I'm a newbie when it comes to COM and generating .net compatible dlls. If you have time to do researches (or already know how to do it), I think it would be a good idea following Remy's suggestion.
I do not have time for research, deadline pressure so timer is fine, moreover there is a database so instead of a file I will use a db table as communication toolm

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.