Web Services that connect to PostgreSql - asp.net

I'm creating an iPhone app that has a DB in PostgreSql. I want to create web services that connect to the database and fetch the data in and out, like for example , I want to create a web service for the login screen of my iPhone app that would connect to the PostgreSql database and authenticate the user.
How do I go about with the web services part..?

Looks like this question is destined to be closed, but before it is locked, I'll try to provide some direction. You can use any of your listed technologies to publish a web service. ASP.NET is my technology of most comfort, so might I recommend looking at using a simple web application with an exposed Page method, and using Npgsql as the database interface.
Using a simple page method isn't the most robust solution, but it will serve simple needs and requires very little specialized knowledge nor a WCF implementation, which can be daunting for some.

Related

building a web proxy to a desktop application using .net

We have a regular .Net4 desktop application built using WPF that exposes a handful of methods via WCF as Net.tcp and also WSHTTP as a rest interface for some simple remote control and remote querying. This is so we can provide some easy 'dashboards' that keep track of what each of the applications is doing around an organisation. We have used MVVM patterns wherever possible with future expansion in mind.
We now need to build a web application for users to do some remote work. Most of this work will be done by the web interface itself directly accessing the SQL database and other resources and rendering HTML back to the end user.
We also want the users of this web application to be able view these dashboards for certain specified desktops, at which point we need to then have the Web application query the desktop applications for the answers.
In due course it's likely that we will expand this further to expose REST or SignalR based or similar to support a Xamarin based set of apps.
My current theory is that we will build this web application using ASP.Net and host on IIS and whenever the user needs to access a resource that requires connecting to the desktops we spin up a WCF connection to the REST services running on it, send the query, process the result and return it onwards to the user.
Is this the best way to go about it, or is there some sort of native web service "proxy" that we can utilise to transparently forward the request from the website user onto the desktop?
Any and all advice would be greatly appreciated!

Xamarin.Forms app SQL-server database options

I've been studying Xamarin.Forms with goal of building cross-platform mobile app in VisualStudio2015. I've got a perfectly acceptable public facing web site but native app(s) are what the boss thinks we need.
The current web app hosted on IIS 7.5 uses a separate project(DLL) for database access to an on-premises SQL Server 2008 instance. This VStudio project exposes domain objects to the calling ASP.NET webforms by executing various stored procedures using System.Data.SqlClient.
I know building the mobile native app itself with Xamarin.Forms is one part of the challenge but I am asking here for clarification about how to approach the database requirements:
Do I need to create some sort of web service that provides the same CRUD functions required by my current web site?
Xamarin documentation lists several options for consuming web services and the more I search and read about data access I conclude that a callable web service of some type is going to be required for my eventual native mobile app.
Is this assumption correct?
Yes. You generally want a webservice layer brokering requests between your mobile app (or any remote client) and your DB server. If you already have all your crud operations in a separate library that is utilized by your website, then a webservice would just be another set of endpoints that rely on the same CRUD library.

SQL Server and iPad app interaction

I have to write an app for iPad that would take data from SQL Server and post it to the iPad. I looked up on this over the Internet and found that i have to write a web service to expose the data from SQL server using ASP.NET. I did an app previously in android that would take data from my dropbox a/c and display it to the user. I made use of the drop-box api available. I was wondering if anything like that exists for SQL? Also, i have to code in Obj-C for the iPad, so how will
i write ASP.NET code? I have more doubts.
Thanks in advance.
There are many options for web services. If you are developing in ASP.NET and don't want to invest to much time in just accessing the data I would suggest some software that will help you generate the source code.
WSSF (Web Service Software Factory) is software that will assist you in creating a SOAP web service and it generates source code for you. I do recommend however working through a tutorial first before just jumping into using this. WSSF uses visual studio as well.
Once you have a web service that packages your SQL data for communication through http requests. You will need to parse the data communicated in Objective-C. For this you'll find SudzC to be very helpful.
SudzC generates all the source code for accessing your web service in Objective-C, given the WSDL.xml file of your web service (a file that lays out the design of your web service).
Although these software will save you a lot of coding, I wish I could tell you that this will be a short and easy process. However this is vary rarely the case, developing this will take you a couple of days.
I do know that people often use RESTful web services when dealing with the iOS enviroment, although I do not have the same kind of experience with them as I do SOAP web services. I hope that this information is helpful to you.
I've done this. The best way is to use .NET 3.5 or higher to create a WCF (Windows Communication Foundation) project. These projects will let you communicate with your mobile application using REST or SOAP. They also let you send data in XML or JSON format. You will then need to create a REST or SOAP client in your IPad application to communicate with the server.
Use OData. See Creating an OData API for StackOverflow including XML and JSON in 30 minutes for how to publish your SQL Server data as an OData service. See Consuming OData using Objective-C for how to consume the OData service from your iPhone app.

Application for updating database

i have published my website...its a dynamic site..so i have database connectivity..now i want to make an application in VB to update my database using my application..i mean i do not want to login to the site and update my database rather update it using my application..i want to connect my application to the database of the published site and update it from anywhere i want using the application...is it possible??
How can i do it??Please point me to the right direction...its urgent.
you can turn on AllowRemoteConnections in your SQLServer. so your application from any where can connect to it and update the DB.
but the best practice for this is using a WCF Service. You should place your methods for updating the DB in a WCF Service farm and then write a client application using Windows Forms or WPF to connect to WCF Service and update the DB using Provided methods in WCF Service.
Although what you want to do is possible you probably don't want to do that. If you are hosting your site with an ISP the hosting company will need to provide the access.
However, as Farzin suggests, you need an integration layer between your application and the database.
You could go with a WCF Service but if it is something simple you could even expose your data using something like MVC.
All you basically need is the security wrapped around your database.
Have you taken a look at Lightswitch? It is currently Beta2 but still quite robust. Using Lightswitch you can quickly set up an app which performs CRUD operations on your database.

ASP.NET Web Forms Applications on Azure (or any cloud hosting)

This is a pretty vague question but I'm struggling a bit to get my head around what is involved in cloud hosting.
Say for instance if I had an asp.net web app using:
- Webforms
- linq to sql
- an sql server database
- Calling some external restful webservices
What would need to be done to host it on a cloud service?
Are there specific code changes that would be required and do these need to be considered in the initial design?
Can sql server and linq to sql be used in this type of setup?
What platform if any would be best suited?
in it's most basic form, Azure is just a highly available web-hosting environment - if you have an ASP.Net web application, you can deploy it to cloupapp.net and it should work.
To try it out, get yourself a Vista/7 machine, download the Azure SDK and VS Tools, and create a new Azure application. There are 2 main parts at this point, the Cloud project, and an ASP.Net Web Application. The ASP.Net will have a "web-role" relationship with the Cloud project. This is as it sounds, it is the visual front-end to the Cloud application, that interacts with visitors.
You can, at this point, just leave it there - it's a normal ASP.Net application with very good hosting. Your SQL connection strings should work, though you may want to consider SQL Azure. You can also host WCF services.
As Manoj points out, Azure does have a different programming model which you can take advantage to produce very robust applications. Azure also has the concept of Worker Roles, which are similar to Managed Services, in that they perform processing without a public interface. Instead, your web-roles take the requests, place them on the Queues, and the worker-roles then pick them up, process and send back responses.
It's a very powerful system, which I haven't fully explored, but the good news is that you don't have to be an immediate expert in the whole system, but can create simple ASP.Net sites as web-roles, deploy those then expand from there.
Have a go, it's well worth it
Toby
AppHarbor is a .NET Platform-as-a-Service. We can host your ASP.NET websites more or less un-modified and without the Visual Studio plugins and other crud that Windows Azure requires.
It depends on what type of cloud hosting are you looking for. There is some cloud hosting which will just give you space for application data like Amazon. While Azure gives you complete application framework which supports your application to be hosted in cloud. But programming in cloud is different programming paradigm than in traditional web form. You will have some limited classes from .Net framework available but better resources for scalability.
You cant directly use sql server in azure application. What you can use SqlAzure services.
Just referring a book which i feel would provide you the answer
Cloud Computing Book
EDIT :
Check this microsoft link
Ramp Up
yes, it is supported and live demo of Asp.NET 4.5 Web Forms available on Microsoft azure websites... you can visit this link for detailed information
Create and deploy a secure ASP.NET Web Forms app with Membership, OAuth, and SQL Database to Azure App Service

Resources