-
Sep 1st, 2020, 10:29 AM
#1
Thread Starter
New Member
Help
Hello guys..
I'm currently working on a project that now has an Asp.Net web page hosted in IIS and guys are able to connect to it and upload their timesheets to a MySQL database. That works great.
But now i'm in need of being able to connect to that same server from laptops that are roaming.
So basically we need to be able to connect to our home server in IIS and then retrieve and sync data from MySql and the remote laptop.
The laptops have standalone VB programs that currently save data to an access database.
We need to be able to store created invoices on the laptop and once internet is avaiable then need to sync that data to Mysql on our server, all thru the internet.
Any suggestions would be greatly appreciated.. was reading up on Websockets and Node js but not sure if best way to proceed.
-
Sep 1st, 2020, 11:04 AM
#2
Re: Help
You already have IIS and possibility to run there web services. Create few web services - authentication of users, get data from server, upload data to server. Then connect to your server public IP address from any connected to internet laptop (or other device).
It is not clear if the IIS is accessible from internet or not. If yes, then it is easy. If not - you need to forward port from your router (connected to ISP) to your IIS where the web services will run. Also it may require the ISP to allow access from your public IP. If the public IP is dynamic, it is better to get own domain and use dynamic DNS services which will update IP address for your domain when the address changes (usually when ISP router is restarted).
Securing the web server with SSL certificate is a must these days. Since the certificate will be used for web services only, it is not required to buy one approved by certified authorities.
Web services can pass offset (ID, date/time) from which the data to be downloaded or uploaded. This will reduce the traffic to server by getting only missing in the local Access db data or by sending only the newly created records (upload service).
-
Sep 1st, 2020, 11:48 AM
#3
Thread Starter
New Member
Re: Help
Yeah, IIS is accessible thru internet.
My problem is i don't know how to create a webservice that the standalone program can access without doing it thru webpage.
Thank you for responding so quickly
-
Sep 1st, 2020, 12:29 PM
#4
Re: Help
Search for ASP.NET REST API. Most articles these days are for ASP.NET Core (.NET Core) but there are some older articles how to use .NET Framework. Anyway, basics are the same but .NET Core (ASP.NET Core) is the preferred one as fully re-written, open sourced (on GitHub) and soon .NET 5 will have merged .NET Framework and .NET Core.
Simplified explanation: the REST API is similar to MVC web apps but without the view. Models are your data. Controllers return the information required (GET) or add/update the info (POST/PUT).
New project wizard in Visual Studio will help you choose the right project and do some tests. Almost everything about ASP.NET REST API can be found as tutorials, videos or source code.
-
Sep 1st, 2020, 12:38 PM
#5
Thread Starter
New Member
Re: Help
Thanks for the help, doing so reading on REST API right now.
-
Sep 1st, 2020, 03:01 PM
#6
Re: Help
Web API is another one that you will come across a whole lot. In fact, you'll come across it while looking at ASP.NET REST.
One thing I like to have for distributed databases is GUID keys. This allows a single record to be identified across multiple databases, which gives you more options for moving data around. The offset and date is one way you can keep track of what needs to be updated. Another would be an Update field. Any INSERT or UPDATE clears the field. You can then collect all records where the field is not set, and will get all updates and inserts. With a GUID PK, you can tell which record needs to be updated on the server because the PK will remain the same across databases.
Deletes are a different matter, if you have any. You might consider NOT having any. For a couple of my distributed systems, there is a simple Valid field. Deletion doesn't delete a record, it just clears that field (and clears the Update field, as well), then you can push the records as updates. What the server does with those is up to you. It can either just clear the Valid field on the server side, or it could go ahead and delete those records.
Finally, as a last step, I like to have the server always send back information to the client. This can be simple (pass/fail), somewhat more complex (pass/some error information) or something FAR more complex (pass infromation/fail information). It all depends on what makes sense for the situation.
My usual boring signature: Nothing
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|