I am developing an ASP.NET website. The users can open up the web page and work with data when they are online. But I want to make them able to work when they are offline and submit their changes later when they are online again. The offline application must be very simple to run and I don't want to develop a separate windows application for this purpose.
So I want to build an executable that when starts, first starts up a local IIS and then opens the startup page of my website (which is locally available) in the user's browser.
And of course it would be great if this executable can be installed on the user's system along with my website files, IIS and SQL Server Express all in one package.
OK I re-read your question and see that you will have local IIS and local Database installed on all client systems.
So then the solution is very simple.
The Applicaiton (main form)
Create a windows forms application.
Put a WebBrowser control and a StatusStrip control on the form.
Add two string resources named say LocalStartUrl and OnlineStartUrl, which holds the addresses of your local and online website home/startup pages.
On Form_Load, check for online internet connectivity and accordingly launch either LocalStartUrl or OnlineStartUrl in the webbrowser control. You can show messagebox and use the StatusBar to inform the user of the same.
The sync module:
The database sync module runs in the timer/separate thread and synchronizes your local database with online database in the background. It sends any unsaved changes to the server and downloads any missing data from the server to local database. You would need to control the speed of this module so that user doesn't face difficulty browsing other websites or using the application smoothly etc. It should be slow and steady and send/request only small chunks of data at a time.
When in offline mode, it just periodically checks for online connectivity at regular intervals. As soon as an internet connectivity can be found, the user is informed. If they permit, it switches over to online mode. Otherwise the user continues to work offline until the application is closed and launched again.
In online mode, the sync module syncs data to & from the online database. This doesn't affect the user because they are not connected to this database. Instead they are connected to the online website and database.
It will take efforts to streamline this approach, but ultimately it is achievable easily.
This won't be just a single task. It would be a series of task working together in sync.
Your windows application does the following:
Write the offline changes to a disk file/database etc.
Periodically check the online availability of your website/ftp site.
Whenever the website is found to be available, and there are some cached changes, submit the file to the website/ftp site.
Your server does the following:
Whenever a file is recieved, check for its validity and integrity. If found correct, put it in a specific folder.
A service on your server watches the folder and as soon as any file is found there, processes the file(s)
The service moves the file to another folder (backup) after processing.
Related
Here is situation:
I have a large collection of videos on a computer, and it will be hooked up to my TV. I would like to make an app to open my videos on my computer from my mobile device (Yes, I know it exists, I am just working on it for fun)
So I have setup a web service, and an app to consume said webservice. The webservice gathers a list of folders/files, and sends them to my device as well as can take in a file path and open it with the default program using System.Diagnostics.Process.Start(path)
When I am using IISExpress, it works fine, but I would like to use IIS. When I use IIS, I open the video file and hear it playing in the background, but it doesn't show up on the monitor. VLC appears in the task manager, and when I kill it, the sound stops.
I'm assuming the issue is the identity under which the app pool is being run, but when I tried to change the identity, it didn't make any difference. If it helps, I am running Windows 8. Does anybody have any thoughts on how I can make the app pool run under my identity, or open the process on the desktop of the active user, rather than open it under the app pool's name?
This is something rather difficult to implement due to Windows session isolation. IIS as well as its worker processes are in session 0, while your logon session is usually > 0. Via native Win32 API it is possible for something in session 0 to launch executable in other sessions, but I don't think it is worth the while.
Please use IIS Express, as it runs in your logon session directly, and don't need to cross the session boundary at all.
With regards to the Process.Start() problem I think in addition to changing the identity of the application pool you also need to go to Services under Administrative Tools and check the box "Allow the service to interact with desktop" under the Log On tab for the World Wide Web Publishing service. I think this has already been addressed in the following question: System.Diagnostics.Process.Start not work from an IIS
Now, if I had to put an app like this together I would try I slightly different approach: in addition to what you have already, I would build a small desktop app that autostarts and sits in the system tray when you log onto your desktop. It will listen for messages from the asp.net application on named pipes or tcp or something similar and start the processes from within the correct user context. That seems a more stable approach, which will also allow you to separate the web server from the desktop where the videos will be played.
I use Visual Studio 2013's "Publish" and Web Deploy to publish my Asp.Net MVC 5 website. However when I update my website, it won't work during the upload. I'm looking for a way to minimize the downtime of the website during the update. The website is running in a VPS and I have full access to it. One solution that came to my mind is to configure the Web Deploy to first put the uploaded files to a temporary folder and once the upload is finished, it should then replace the new files. This would make the update a few seconds tops. I can do this manually but that's not an elegant way to update one's website.
PS: Maybe there are better ways to update the website but so far I like the web deploy. It's much faster than FTP for instance.
One of the most interesting things I've seen is to have two websites. Only one of them is running at a time. After finishing the upload, you disable the active one, and enable the one you uploaded too.
This works well if both are in the same Application Pool and even works with sessions if you want (how to: Configure SQL Server to Store ASP.NET Session State).
I've never done it this way, seems a little to complex for the minimal down time there actually is, but it's one way.
Here's the solution that we use on a high traffic website with 4 web servers.
1) Files are moved to the server into /site/version-xxx
2) IIS Web Application is re-pointed to the new version.
All this is automated and synchronized across the web servers. The end user doesn't notice any difference. (we don't rely on sessions to persist the user experience, if sessions is a must for you and you don't want to interrupt them, then you need to consider to store them on an external system that will not flush them when the websites are repointed).
This approach also allows us to rollback to any previous version.
I have a dll i created that gets the excel object on users computer(if excel is installed) and has a handful of availalbe functions. I made a reverence to the dll in a Web Application. When I test this using the local host it works. If I deploy this on a Web Server will it still work or will it try to find the excel application on the server?
Without seeing your code I can only offer a guess, and my guess is that it will search the server and not the users computer.
You can probably use ActiveX to call Excel from the users computer, but that would only work in IE. I'm not sure who your audience is, but I needed similar functionality for the company I used to work for. For that I made a program that was installed to all users computers and then we used a custom http protocol that would open up programs on the client machine through a hyperlink. Doing it this way is cross browser compatible.
I have a program running on my desktop machine that makes a WCF service available. This is a regular Windows Forms application that I run when logged in as a normal user.
I put the WCF interface in so that I could see the status of the program from an external web page. This works great, I can see the status of the running program and even change things as I see fit.
The only thing I can't do is start the program. If I go to the web page and the program is not running, I'd like to be able to start it. A simple Process.Start(programEXE) doesn't suffice because while the program starts, it is not on the desktop and I can't see it, though it does show up in Task Manager.
I tried creating credentials and launching the program with those credentials, but it exits with a very vague "Program failed to start" error, or starts with my credentials but still doesn't show up on the desktop. In the latter case, I see it in Task Manager under my name, but don't see the actual program.
So, How do I start a program on the server, visible on the desktop of the logged-in user (There's only one user and that user is always logged in)?
Also, what are some things that I can do to ensure that this doesn't become a security hole? One thought I had was to run the launcher.aspx in its own virtual directory, under a userid that only has read permissions to the one directory where program.exe is located, and has no other read or write permissions. Any other suggestions?
Finally, just to be clear: I am not trying to launch anything on the user's computer. Clicking on the "launch program" link should launch a program on the web server and not on the client machine, and that program should be visible to the logged-in user on the server.
I'm almost positive that you can't do that. Your IIS runs as service and does not have a specific desktop environment associated with it. What you're trying to do doesn't really work in the web/server environment.
I'd recommend that you change your win form app to a windows service and then you'd be able to start/stop it via web site. If you enable "interact with desktop" with the windows service then I think you'd be able to have a form.Show() bring the app to the current user's desktop environment.
If you are the only person that needs to run the winform app, then why not just start the app yourself? You state that it'll probably never be used by any computer other than your own computer, so it seems like a complicated method of accessing a local web site to start a local winform app when you could just start the winform app via shortcut.
A forthcoming project requires that a Flash projector (.exe) be kept on a server and accessed by multiple users over network (LAN). There will be a central access database as a back-end. I am using a third party SWF2EXE (SWF Studio) product to have database functionality. I would like to know if sharing an .exe file this way is practical. I know it's not a typical client-server methodology but I can't use Server side platform like ASP due to lack of resources at the client's place. Is it likely to cause any crashes if the same .exe is launched simultaneously by network users doing a simultaneous read/write to database (mdb)?
Each computer should get a copy of the exe file, and it should be only the database which is shared. If you are on a LAN and you are using MS Access, placing the MDB file in a shared location should be fine.
You may also want to check what the concurrent user limit is for an ms access database.
Andrew