简体   繁体   中英

How to develop WCF app with SQL on Azure Server

How do I develop a WCF application in Windows Azure, using SQL Azure data?

Output should be in JSON format and input methods would have more then one parameter.

Requests would come from mobile devices, looking like "http://myservice.cloudapp.net/WCF_Serv?id=1&Table=emp"

All Devlopment would be C#.

The question you asked is very broad, but assuming you're just looking for how to get started with WCF and SQL Azure:

Take a look at this Windows Azure Quick Start sample for setting up a WCF service in Windows Azure. You can then modify this sample to call out to SQL Azure to retrieve data. If you've worked with SQL Server, you should have no problem working with SQL Azure.

You can also look at this Quick Start sample for using SQL Azure with a website. You can borrow the salient code and use it with your WCF service.

EDIT: One thing I just noticed, while editing your question to be more readable: Your example looks like it's trying to directly access a table:

http://myservice.cloudapp.net/WCF_Serv?id=1&Table=emp

You are actually naming a table in the call (in this case, emp ). In my opinion, this is not a good practice. Instead, you should be shaping your WCF services to return something meaningful without exposing your database schema.

Create new Windows Azure project , and then add WCF project as Web role or Worker role . Provide your SQL Azure database connection string in WCF config file for connecting with SQL Azure . Rest are same.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM