I have a C# Windows Forms application. Can I deplo

2019-05-05 02:57发布

问题:

We have done a Windows based application useing C# (.NET 2.0, Visual Studio 2005). Now redoing this application web based, is a time and resource consuming process and which is next to impossible for me.

We need to host this, so that the user can access through the Internet.

Through RDP the user can access the Windows application, but the issues here is more users can not operate simultaneously.

Can it be hosted as a web application, so that the user can access it through browser?

回答1:

No, you cannot make it available directly via the web as you would a website, Windows Forms applications run directly on the client machine.

What you can do is package it up as an MSI installer, so that the end user can easily install it, and then have access resources such as a database via the Internet (the simplest way to expose these resources is as a web service). If you choose to use this mechanism then you will only have to refactor part of your application, assuming that you have already structured it nicely into an n-tier application.

Note that the user doesn't have to access these resources via the Internet though - your mention of users employing RDP would suggest that you have it sitting on an intranet, which means you may be able to "host" services such as a database on an machine that all the clients can see (and access) across the network. In this case all that may be required is to change any connection strings or paths you may have sitting in the configuration file of the application.



回答2:

You could at least deploy it via the web using ClickOnce

ClickOnce deployment enables you to publish Windows-based applications to a Web server or network file share for simplified installation. Visual Studio provides full support for publishing and updating applications deployed with ClickOnce technology.

http://msdn.microsoft.com/en-us/library/t71a733d(v=VS.90).aspx



回答3:

You can deploy your application through the network using click-once and support updates trough it but I don't know any way to transform a winform application into a web-based application and I really doubt there is one considering the fundamental architecture changes between the two plaforms.



回答4:

I would recommend investing some time and modify the architecture to adopt SOA.

You should restructure your code and create a web service that would expose methods to the clients. These methods would take input from the client, perform operations and give back the data to display to the UI. You can pick your core business logic classes from the existing solution and reuse them as is. There might some amount of effort involved to separate out presentation logic from the business logic, but it would well worth the effort.

Once you have your web service` hosted, you can use it with either a desktop application, or a web application. Of course, you would need to code the UI for Web application, but it would be much easlier than writing it from scratch.



回答5:

If you are using a database application in Windows then you can do one thing. You can deploy the database on the server, but you want to design a front-end application in ASP.NET for it, so that you can use your Windows application on the machine where you installed your application, and all others can also access it through the web.