简体   繁体   中英

Deploying a sql server based webservice on azure virtual machine

I have developed a web service in VS2008 in C#. The service queries a SQL Server Express 2012 database and returns the results. When I test the service on local development system it works fine.

Now I have a windows azure trial account, and I want this service to be deployed on a virtual machine.

1- I have tried to create virtual machines with SQL server and Visual Studio on it, but could not create the service there. VS does not have the Web services template there.

2- I have tried to create the deployment package on my dev system and tried to install the service but it also did not work.

Please suggest the correct way of doing this task. I am very much new to all these concepts so may be I am missing some basic information and a step by step guide will not hurt.

  1. Install Visual Studio 2012 Express for Web
  2. Get your application working in that version, and preferably upgrade it to .NET 4.5.
  3. Create a Windows Azure SQL Database by following this Getting Started guide.
  4. Download version 4.0.15 of the SQL Azure Migration Wizard from CodePlex .
  5. Use the wizard to migrate your local database to Azure, being sure to fix all the problems it reports.
  6. Set up a Windows Azure Web Site and publish your service to it as described in this article .

I am not sure that you did it that way, but the easiest way to create a cloud-hosted web service with MS SQL Backend would be:

  1. Create a new instance of SQL Azure in Azure Management Portal .
  2. Create a new database (probably a web edition in your case).
  3. Use the connection string from the portal and Azure SDK to develop an ASP.NET application (web role) hosted on Azure. You can locally test this application in the similar way how you test your current ASP.NET application, provided you set up the firewall on your SQL Azure instance for inbound connections from your external IP. ( here is the step-by-step tutorial for the first three steps)
  4. Create a new instance of cloud service in Azure management portal .
  5. Deploy your application to the cloud directly from Visual Studio. You'll, however, need at least Visual Studio 2010 and the Express Edition would already do.

( Update: As Mark Rendle suggests in the comment and in his answer , there is no need to create a separate cloud instance as long as your service is light-weight and does only data fetching. Cloud instance would be, however, essential, if your service requires data processing or has some other logic entailing long-running processes).

Alternatively you might want to use Azure Mobile services , that already provide a web service for SQL Azure that might do. This is a fully RESTful web service and you'll just need to write some logic in JavaScript, similar to Node.js implementation. See an excellent tutorial on this issue.

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