I solved that problem like this:
Create a small winforms application that runs (or minimizes) in the tray.
Get the assembly Mono.WebServer from the mono-project.
Add it as a reference to your web-application, set localcopy to true.
Put your web-appliaction into folder c:\whatever\YourWebApplication
Reference the same version of mono.webserver in your winforms application.
Have the application start at a port > 10000 (so it doesn't require admin rights)
Open a browser of your choice at http:// localhost :yourport (you can xcopy google-chrome and use it without admin rights) with system.diagnostics.process.start
And use the web application as desktop application.
If you use Firebird, you can use Firebird on the web, and Firebird embedded on the desktop.
If you use MySQL, you can use MariaDb (just copy the zip-deploy into a folder of your choice, and start the database before you start your application).
If you use PostgreSQL, you can use Postgresql Portable, and xcopy deploy before you start your application.
if you use SQL-Server, you're screwed, because SQL-Server express will require installation...
public static void Main (string[] args)
{
int Port=18080;
string path=@"c:\wherever\YourWebApplication";
XSPWebSource websource=new XSPWebSource(IPAddress.Any,Port);
ApplicationServer WebAppServer=new ApplicationServer(websource);
//"[[hostname:]port:]VPath:realpath"
string cmdLine=Port+":/:"+path;
WebAppServer.AddApplicationsFromCommandLine(cmdLine);
WebAppServer.Start(true);
Console.WriteLine("Mono.WebServer running. Press enter to exit...");
System.Diagnostics.Process.Start("iexplore http:// localhost /:" + Port.ToString());
Console.ReadLine();
WebAppServer.Stop();
}
If you want the data to be on a central server, you need to use web-services (JSON/JSONP) and http-post to update and retrieve data. However, this is not very offline-ish.
In any way, avoid having to maintain 2 separate applications at all costs.
You can also synchronize dbs between the offline and the online version.
You'll need a web-service that syncs the data (and schema) between the two.
If you operate with GUIDs (uuids in PostgreSQL) in your tables, you can sync new entries in your offline database relatively easy to your online database.
The problem starts when you delete or alter entries.
You'll need to handle "what happens if somebody else altered after you synced and went offline, and you altered the same field in the same row, but to a different value ? )
And how do you detect deletes ?
A new row might have been added after you went offline, so you can't just delete any row that's not in your offline-db anymore...
An easy solution would be:
Block alterations & deletes in offline-mode