简体   繁体   中英

Porting a C# desktop app to web

I built a desktop WPF C# application for some purpose. The C# application calls functions in another C++ application and the results from the C++ application were exposed back to the C# application. The application is working fine, but I intend to take same functionality to the web (ASP.NET)

Can I use the same kind of thing that I used in my desktop solution? Can the ASP.NET application call a function into a C++ project, and get back the results from the C++ application? DllImport[CallingConvention = CDecl, CharEncoding=Ansi]

EDIT--
My primary concern is that when I issue function call to C++ application, it takes 5 seconds for the C++ function to do its processing. During this time, the C# application can be considered to be have a froze GUI. What would happen in similar case in the ASP.NET website? Would it be a mess because of multi-threading and all?

是的,ASP.NET应用程序可以使用DllImport机制。

There are no problems in calling COM or pinvoked methods from within an ASP.NET application. Even if the call lasts 5 seconds to complete, the client's browser just wait for the answer. As a result, the user experience of your application is just sluggish.

Usually such long lasting server calls are wrapped then in AJAX requests so that at least you can show some information to the user like a spinning circle with "please wait" or something similar.

it is basically the same! wpf uses the same clr as aps.net the difference is, that a web-app is mostly a multiuser environment. so your com/c++ component must work with concurrent users.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM