Architecture design help - c#

I'm looking for some input on my current project architecture. There are three components: Server, Desktop, and Mobile Device.
I have 2 goals:
1) Send data (Approx. no more than 100 KB of text) from the Desktop (multi platform client application running on windows XP/Vista/7, and Mac OS X) to a server (Windows Server 2008, IIS 7, WCF RESTful service) to save in a database (Sql Server). The services need to be scalable because the number of desktop devices and frequency they send data is unknown.
2) A service to retrieve data from the database (Sql Server) and send to a mobile device(Iphone and Android application. Message size no more than 100 KB of text). Service needs to be scalable because number of mobile devices and frequency they connect is unknown.
My proposed solution:
Server Side (Sql Server and Windows Server 2008):
I'm looking at a WCF RESTful JSON services to communicate with Desktop App(s) and Mobile App(s). I like WCF because I am most proficient in C#, have some experience implementing WCF, after doing some research it appears all technologies used for the platforms(Windows XP/Vista/7 and Mac OS X) can easily communicate with the WCF RESTful service.
Any high level fundamental issues with the WCF service in this scenario?
I have only implemented WCF on a Windows Server 2003 machine with ~800 devices connecting every 15 minutes. The server was a physical in house server running on a private network. I need this solution to be hosted and scalable. Any recommendations for hosting a Windows Server 2008? Is there a better technology to host the service? (I'm not very familiar with how the cloud stuff works)
The services will be saving and retrieving data from a SQL server. I would like to use LINQ to SQL as my data access layer. It's my understanding there are large licensing fees tied to SQL server so I may need to go with SQL Server Express for now.
I'd prefer to keep the WCF services and database hosted separately (2 diff machines). Any recommendations for hosting sql server(or express)? Is there a hosting service that can scale better for my database? Does it make sense to keep these on 2 diff machines?
Desktop (Client Side)
I am required to develop for Windows XP/Vista/7 and Mac OS X. I plan to write a .net application to run on the windows machine(s). I"m still up in the air if i'm going to write (and learn :P) XCode or try mono. Any cross-platform ideas?
Should I expect to have any fundamental problems getting the desktop applications to talk to my WCF RESTful services?
Mobile Applicaitons
I am required to developer for the IPhone and Android. There are many examples of making WCF RESTful service calls using Objective C and the Android SDK. I'm considering trying a cross platform (ie. Appcelerator). From a high level it appears these mobile cross platforms have built a Java script layer that works with both IPhone and Android!
Any thoughts on using the cross platform technology to write ONE mobile app to run on IPhone and Android?
Any fundamental issues calling the WCF RESTful service in javascript?
Sorry for the somewhat long post. I have never designed a solution of this size. All feedback is appreciated.
Thank you!

As you are clearly wanting to use Microsoft technologies - the suggestions about Mono probably make sense to you and will certainly make things easier.
However I think you may find that you compromise elements of the user experience for Mac and iPhone users which is not ideal as these users tend to have the highest expectations for great user experiences.
I understand that we don't live in an ideal world but if we did you would develop a separate client for each platform - optimised to the needs of each platform. Unless you application is doing a lot of data manipulation the data layer is now abstracted to the server viw your JSON interface so you will not gain much from sharing the data objects across implementations.
As it seems you are implementing the project in a small team (yourself?) then I would suggest that you look at implementing a web solution with the HTML javascript communicating with the server over JSON.
The other option is that you use a flex/air client on windows and mac and flash on the android and Adobe's solution to compile flex/air into iPhone code.
Good luck though.

For your client side you may consider using Appclerator because it will run on all of the platforms that you need with little to no extra code, and it is designed to be used for web app type applications

You should consider MonoTouch for the iphone. You'll be able to share much of the desktop code. I would use Mono on the Mac for the same reason. Android is the odd man out. Eventually someone might create something like MonoTouch for Android but not soon enough to help you out.

Related

UWP app and WPF app communication through local network

What is the best approach to communicate between UWP app (client app) installed on phone and WPF app itself installed on local machine if they are connected to the same router? Files should sync from client to server and vice versa.
As I investigated before there are WCF, Sockets, and Web. So what is the best one to use to create such functionality?
It does not matter if the app is WPF or UWP. To choose framework like WCF or Sockets you need to know how complex your scenario is. If it is rather simple, I would advice agains WCF. It can be unnecessary complicated for basic usage. You can try web api - lite system using JSON. Generally speaking, I do recommend the framework enabling http protocol as it is reusable for almost every scenario. But that is not filter that would help you much :D
For UWP that have not allowed calling localhost and you can use it to communicate to local wpf app.
More details here and here.
But you can make the uwp communicate to local wpf app in debug, see Deploying and debugging Universal Windows Platform (UWP) apps - UWP app developer | Microsoft Docs
If you want your uwp app can use localhost in release that you should use checknetisolation and you can see some way to use wcf in the article.

MonoTouch connect to Azure ACS, Azure SQL / Azure WCF

I'm going to make the iOS application and wondering on differences between development with new language Objective C with Cocoa or old language C# with Mono-Touch
The requirement of the application should be work with azure and store/retrieve information to store on local device frequently, content browsing and token login to the portal, the deadline is 2 month from today and i never develop any iPhone / iPad application previously. May i know which is easier to start and is there any resources for Mono ? while i find it's great if i could use the old programming language but seem there're no such thing to support monoTouch azure development...
Thank you for reply.
First of all your have asked lots of things in one post. About your first question the answer is very much subjective. Objective C/Cocoa is native language for iOS development however using MonoTouch, will require you to depend on whatever is provided by MonoTouch. So if it is not part of MonoTouch you wouldn't be able to do it. Here you can find lots of opinions by other fellow SO users: MonoTouch & C# VS Objective C for iphone app
I can give you some guidance on Windows Azure development from any mobile device. Connecting to different services running on Windows Azure from any mobile device is same. Most of the services provide direct HTTP/HTTPS connection if the application is running on Azure and exposed an HTTP or HTTPs endpoint or for Azure Storage you are making direct RESTful call from you code. So it does not matter which coding language you will use in mobile decide, you sure can connect to Windows Azure with native language.
So if you choose Objective C then you can use iOS SDK for Windows Azure. However if you decide to use MonoTouch, you would need to use WebClient API to create your own HTTP/HTTPS connection something described here, which could be comparative complex. On internet you may find some experiment level code to use Azure services and MonoTouch application so you may be by your own to try to get things working.
I personally will not use MonoTouch to develop application on iOS devices, if I am heavily dependent on Windows Azure Services, instead I will choose iOS Windows Azure SDK to connect Azure Service through native code.

Windows Azure and Metro-style apps in Windows 8

I have atleast 5 billion ideas for a new App in Windows 8. However, most of them rely on a remote database connection.
Which is currently not possible in Metro apps. But I don't want just a work-around. Or an script that accesses an API which will access the DB and return results. So then I went to the MS forums and found a post somewhere (which I can't seem to find now) stating that I can just use Windows Azure SQL database and can connect to that one from within Windows Metro.
But I don't see any resources or documentation to back that up and I'm completely lost as to what to do.
Most apps these days, to offer any sort of personalized user experience need to communicate with the outside world and it's just impossible to do in Metro apps from what I can see.
Does anybody know if you can connect to a Windows Azure SQL DB from within a Metro style app? Any resources/Docs/Links/Samples you know of?
Thank you!
Metro apps are optimized for tablets and generally CPU-and-battery constrained devices. Directly connecting to a database and processing the results is expensive in CPU, battery AND bandwidth terms.
What's more, database protocols aren't cachable and were not meant to deal with internet latencies. Your app could waste a lot of time trying and retrying to connect to the database each time the connection quality degraded.
The best option would be to a set of WCF Data Services on top of your database and expose them to your application. It's easy to create a WCF Data Service on top of an Entity Framework model and the OData protocol used by WCF Data Services allows querying your entities using LINQ in an asynchronous manner. More complex processing can be done in the web server.
At this point Metro does not have a System.Data so there is no direct connect to the database. You would need to communicate with the database via WCF to a Web Service.
Metro does have a user settings facility but I cannot find it right now. http://msdn.microsoft.com/library/windows/apps/BR208189
The history is that the jumping off point for Metro was Silverlight. Not saying that makes sense just what I have read. It appears Microsoft wants to sandbox Metro for the Metro Store.

Distributed application (WCF/Remoting/web servervices) Vs Web application

I am making a medium sized standard LOB application. Currently its a web application but I am formulating a proposal to revamp it into a Desktop remote application. By this I mean that the database and the application server will be hosted in a remote location. The client application will communicate with the server via the internet through (either WCF / Webservices / Remoting).
My question is this: The only reason I am shifting this from a web platform is due to the constraints of the web (I dont want to do AJAX or Java scripting to minimize those constraints, so please no JS/AJAX recommendations). I have made traditional desktop applications and they are considerably fast but i have never made a remote or a distributed application. I am not sure weather the speed of the application will be faster then the web or not.
As I understand it, the remote desktop application would be much faster. For one, there wont be any post backs involved, (I hate them so much). The data will obviously come via internet, so in that respect, is it better to shift to the remote desktop just for sheer speed and power?
Any help in the right direction would be greatfull. Many thanks.
Zeeshan
I think biggest advantage of desktop clients over web applications is freedom in UI design, and you don't have to worry about any inconsistencies in the client environment, although those are not an issue if you are using a client that runs on silverlight.
Personally I don't like web applications that requires a lot of user interaction, there are some of them that is a pleasure to use but I think it is very easy to do it the wrong way and end up having a buggy or not so responsive application (probably because of the incompatibilities in browsers, I have IE, Firefox and Chrome installed on my computer and I use one for some websites because they run faster on it, and others for other sites because web pages show up correctly only on them). Though this might not be an issue for a silverlight client.
In case of network speed, depending on the things that goes on the wire even with binary serialization remoting might have quite a bit of overhead. For example along with the data it writes full class names, library names and their versions so it can get pretty big and slow even for small amounts of data (although it should still be smaller then HTTP). It also has the same problems that HTTP has over unreliable connections because it uses a similar protocol. For one project we had to write a custom serializer for some objects because binary serialization alone was generating 200K, but our custom serializer for those objects were generating 50K. Then we ended up writing our own network protocol because the one that comes with the runtime was frequently stalling over unreliable wireless networks, and remoting doesn't give any control on the socket created by it (which makes sense in terms of encapsulation but you can't close it and force it to open a new one).
(I am assuming that you are asking about remoting vs web app. not remote desktop vs. web apps, because of your note about post back, you can't avoid it with a remote desktop session)
Rewriting an application just for sheer speed? No, because probably user won't see much difference in response time.
You are somewhat ambiguous with your terminology - do you want a client app that runs on the user's machine, or do you want an app that runs on the server and the user connects via remote desktop (RDP)?
If you are talking about a client app that communicates to the server via WCF etc., then yes it will be faster than a standard web app, although it will still be slower than a native desktop app. It will be faster than the web app not just because of the lack of postbacks, but also because you will be sending pure data through the wire, not a massive amount of HTML/Javascript combined with your data. With a client app, you have several options so consider them carefully - do you want Silverlight, WPF, or a native WinForms app? Each have their positives and negatives.
If you were talking about having a client app running on the server which the user then access via RDP, then you have other considerations to think of. For any more than two concurrent users you will need to consider buying CALs so the users can connect to the server. At this point you should also be considering whether you should be running a terminal server or Citrix type setup instead of using remote desktop.
Edit
When using WCF over a WAN (internet) you will certainly have to consider how you will secure it. WCF makes it trivial to secure the channel, but you need to consider how you will do authentication - there are a couple of different ways, but you can easily google that stuff yourself. The method you choose will be important due to the limited resources or skill-sets of the users.
As for what you write it in, you can't argue with Winforms if that is where your experience is. Personally, i would never again use ASP.NET/Ajax/etc for a web type application, it would be WPF or Silverlight all the way (i would only use ASP.NET for simple web sites). You can use the express (free) versions of Visual Studio to write it in, you don't need Expression (it's just a nice to have, and is more aimed at the design side than the actual coding side). Deploying the app need not be difficult - Silverlight or WPF xbap are delivered via the web, the user has to do nothing (except for the simple install of the Silverlight plugin or installing the right .Net framework for WPF - check this link). Winforms or stand-alone WPF require slightly more work, but you can avoid most issues by writing a good installer.
Whichever you choose, make sure you don't under estimate the time for development (because you will have a bit of a learning curve), and also make sure you budget enough time for testing it - especially the security side of it :)
I have been in a similar situation, although started with a Winforms LOB application.
Heres what we found with WinForms...
It's going to be harder to deploy in your release cycle, to all client machines.
WinForms can't be run on other operating systems easily. (with the exception on mono)
WCF endpoints can get complicated, and you need to manage an endpoint for release/version of your application.
Authentication, Authorization and Security can be tricky to get right!
Heres why you should stick to a html web application.
it's going to be easier to deploy, as you just need to copy one set of DLL's into the bin folder. Can be scripted from a continuous integration or staging server.
Security is going to be easy, by using a SSL certificate.
Silverlight/Flash should fill in the gaps that HTML leaves out.
Microsoft has also combined the connected systems in .net 3.5, they now call it WCF (ASMX/Remoting/etc...). It's got quite a learning curve 4-5 weeks.

MongoDB for C# and iPhone app

I'm in the initial phase of designing an application that will have a backend implemented in C# that will provide data for other platforms using WCF web services hosted on IIS. One of the platforms will the the iPhone.
Since it's a personal project, I want to use it to learn MongoDB. I already know that there are community developed drivers for MongoDB and C#, so I could handle the persistence on the server side using MongoDB.
Without even knowing the replications models offered by MongoDB, I was thinking about some kind of simple synchronization model to keep data local if the iPhone is not connected or has a poor connection.
Here's the question: Can MongoDB be used in the iPhone using the MongoDB C drivers? Has anybody already tried that?
The typical iPhone architecture is to have your application call out to a web service. Even if it is possible to use a MongoDB driver directly from a mobile client I would not recommend it. For a few reasons.
You are basically talking about doing client server architecture where your client application talks directly to the datastore (MongoDB.) What about security? When any authenticated client talks directly to the datastore all sorts of bad things can happen.
Tightly coupling your client application directly to any given data access technology is dangerous in that it would require you to rewrite your client if for some reason you needed to change your data access solution.
It is more common these days to have your client applications go through a data access tier and when the Internet is involved this tier often involves a web service of some sort unless you want to get elbows deep writing server code.
Think about writing a RESTful api exposing your datastore to your iPhone client. I've heard good things about Open Rasta (C# REST library)
Edit - More about hosting MongoDB on the iPhone
Sorry I didn't understand that you wish to run MongoDB locally on iPhone. MongoDB is a server. I do not believe that it is embeddable as an in-process datastore. And it is not possible to run more than one process on the iPhone.
If you are familiar with C# you might want to check out MonoTouch. It allows you to run C# applications on iPhone. There is a nice library for using SqlLite which is supported by iPhone.

Categories

Resources