I've written an application in C# that I would now like to host within an ASP.NET website (MVC 2).
The application can become quite resource intensive so I would like to set up the system in such a way that each user downloads the application and runs it locally, but still within the web page that I provide.
My first idea to solve this problem was to host the program within a silverlight application. However, the app I want to host was not compiled for Silverlight, and I would like to use MySQL in it, which also appears to not be possible directly (ie without a web service in between).
The bottom line is that don't have experience with these things directly yet, and I need to research the way to make any solution possible. So I would really appreciate some input to put me in the right direction, and not have to implement 3 wrong options before finding the right one. I would also really like to avoid JavaScript if at all possible.
Thanks in advance.
Update
I probably should have specified to begin with what the application is exactly.
The application as I want to host it on the website is a simple chat program. It needs an input box and text output. The old windows forms application won't have to run in ASP, but I want to use the class library behind it, which is a chatbot engine. That engine is the part that can be rather resource intensive.
So you wrote a "rich client" application and you want to serve it as a web/silverlight application. This is not possible without changing the architecture of your app, as you probably guess, expecially because you have to interface a database. If rewriting the application to support such architecture is not an option, the best in order to me is to use Remote Desktop, but you have to pay for licenses in order to support many connections.
If your application is not a web application then it will not run on the server. The only thing your server does is to provide a download location. For that, you wouldn't need a MVC site - static pages could fit. The programming model between normal applications running on the client and server applications running on IIS is completely different. So in short: you won't be able to host your client application in ASP.NET MVC. If this is a requirement you will end up rewriting the application.
If your application is ASP.NET WebForms and it becomes too resource hungry, then you probably won't solve it by just switching to MVC. You have different options then: more resources on the server side, analyzing what could be done to lower the resources required or moving away from a server based application. This is not a black/white decision, maybe a combination might fit.
Related
I'm looking for some techniques that allow me to create an application using winforms, the basic idea is to load the gui interface from server, whereas the other files resident in client computer.
It will be applied in LAN environment and the application GUI must be modified repeatedly
thanks in advance
What you basically do is to put the "rendering stuff" work on the server rather on client side. you could archive this using streaming protocol BUT. WHY?
First of all WinForm is the oldest and also the less efficiency way to build windows UI (WPF and UWP are made and always recommended to avoid old technologies like winform and javaswing)
Second if you want to render on the server there are better approaches and technologies to do such as (Blazor serverside, ASP.NET Razor Page, or even the old Web Form would be a better idea) through the Browser.
I've written a c# .NET winforms application I'm quite happy with.
Now I came to the conclusion, that it would be great to control this app also over the internet.
My idea is to just include a webserver into the EXE that will show the GUI of the app in a webbrowser also.
what would be the easiest way to do so? This is a hobbiest project, so I don't want to pay for commercial solutions.
Thanks in advance!
Markus
Unfortunately or fortunately including a webserver in your EXE is definitely NOT the way to go here. In fact it won't and can't work that way.
What you need to do is separate out your business logic (the code that does the processing for your application) from your UI (the winforms control parts) in such a way that you can build a web front end that connects to your business logic. If done properly you can use the same business logic for both UI's. Your web front end will have to be hosted on a webserver somewhere but a winforms app can't be hosted in a web browser... it just doesn't work like that.
Read up on N-tier programming or the MVC pattern to get started down this direction.
At work, we're currently discussing the eventuality that our product needs to be a web application, mostly due to ease of distribution (e.g. getting servers set up by the IT departments of our customers).
Our desktop application is heavily reliant on user input, it has lots of forms and hundreds of controls which are shown and hidden based on others.
My question is, is there a NICE/EASY way - without having to remodel the entire product, which is our current solution - to make this easy for web development?
Thanks in advance.
If ease of distribution is the primary concern then maybe using a Windows Forms ClickOnce might be a viable option as you can publish your application on a webpage and users can run the application from that webpage, but it runs as a local windows forms application - and if you don't need to make any changes to the local registry or other elevated rights operations then all you need on that machine is the correct .NET Framework for it to run.
What I am looking for is a way to write the UI once and get the same running both in browser and on desktop.
We would like to use C# and SQL Server / MySQL as DB. Can you suggest the best way to code in c# to make this work
We are thinking of writing forms in WPF and then writing a wrapper to show as an application and to show as a webpage too. is it practical as we do not have experience in working of WPF
I don't think writing a wrapper around WPF application will solve your problem. You can convert WPF application to Silverlight (Which is for web) , but there are limitations.
Here is a good question for that : Convert WPF Application to SilverLight
One better way of doing it is layered architecture. You can write a data access layer and a business layer, Then you can have separate UI layer for both Web applications and desktop applications. Make your solution as loosely coupled as possible and this will help in having separate applications for desktop and web.
It's not possible to reuse a WPF application as a Web application. A Web application has a totally different setup then WPF. Web uses stateless HTTP while WPF runs completely on a clients computer.
Your best bet is to make sure you can reuse as much of your code as possible. By using a layered architecture you can create two applications that only differ in the User Interface layer.
Then you can optimize for both platforms but have a single shared code base for all other aspects of your application.
we need the rich experience of desktop, and accessibility of web application too
I suggest that you take a look at Silverlight. It runs in the browser and deploys seamlessly like any web page. And you get a "richer" client experience compared to a true web application.
I'm a beginner in programming. I've just made a program called "Guessing Game". And it seems to work fine. Can I integrate it into a website? The CMS that I'm using is Mambo.
===
additional info's
Thanks for all your suggestions.
I still don't have any background about Silverlight, WPF and Java Script which I think sounds good. I'm using Windows and I programmed my "Guessing Game" from Microsoft Visual Studio 2008 and it's using Window application forms.
Yes I guess, for the moment I let it be and start to learn Silverlight or Java Script so that I can integrate it on my website:-)
Thanks for all your input guys:-)
Cheers
A standalone executable cannot be directly integrated into a website. You have a few choices though:
Allow your users to download the executable and run it locally for themselves
Rewrite your program in JavaScript to have it run directly inside of an HTML page, though this could obviously involve a fair amount of reworking
Use Microsoft's Silverlight technology, which allows you to code in C# and produce a web-based frontend similar to Adobe Flash. Your program logic should remain the same and you should only have to change the UI code. In fact if you're already using WPF for the front end, the transition will be even easier.
There are several questions that you still need to answer.
What is your server running? If its not Windows, your exe will not run at all unless it is compatible with Mono or a similar framework for your server's operating system.
How does your "Guessing game" interact with the user? If it is through a WinForms GUI, it will you will not be able to use that GUI on the web. If your game is a WPF application your easiest route may be to port it to Silverlight and serve it up on a web page.
It is typically not trivial to make a regular windows application run in a web environment since on on the web you are really running in the browser, not on Windows.
Yes - in general, when you're talking about software, anything is possible. The question is, how difficult will it be?
To understand that, you have to give us more details about "Guessing Game" including how it is designed, what it's interfaces are, how readily extensible it is, and how prepared you are to change or extend it.
For example, if it is a Windows Forms GUI app, then it will be diifficult to integrate into a web app. If it is a console app, then it will be a little easier. If you can modify it to run as a Windows Service, then a little easier. If you can modify it to accept input from the network (as opposed to getting input solely from the keyboard + mouse), still easier.
You may be able to use reflection to load your assembly into the web application, but most likely, the answer is no.
Your best solution is probably to re-write the game in javascript.
The short answer to your question is now. I'm presuming that since you're running Mambo you're web environment is a LAMP stack. However, you're "Guessing Game" is most likely a Windows application from the sound of it. For a beginner in programming, there is no integration path you're going to be able to take that will allow you to have your game running on your website.
However, here are avenues you can take, which will require a significant amount of time to learn. I'm not saying you shouldn't take time to learn, by all means you should! I'm simply trying to illustrate the fact that this is not something that is going to be doable in a couple of hours.
Silverlight - allows you to run C# code with a WPF like interface on your client's browser and can integrate with your web site through javascript.
Let your client download it from your website and run it off of their PC. This would actually be fairly trivial and would be your quickest option, but it sounds like it's not the kind of integration you were looking for.