Changing existing WCF project to Azure project

爷,独闯天下 提交于 2019-12-07 09:12:26

First of all you have to check the project type in Visual Studio 2010. Please assure that the project you want to deploy is of type WCF Application or WebApplication (hosting the WCF service). If it is a Website project (hosting the WCF service) you can easily convert it from within Visual Studio to a WebApplication project.

If your project is a WCF library then you will have to host it first in a WCF application or WebApplication project before you can deploy it to Windows Azure (or even better host it directly in a Windows Azure WCFServiceRole or WebRole project).

Then you have to install the latest Windows Azure SDK so that all the Windows Azure features are installed on your development machine. And you should have the "Add Windows Azure Deployment Project" option.

To host the WCF library in a WCF Application do the following (should be nearly the same for the Windows Azure WCFServiceRole project):

In Visual Studio 2010, create a WCF Application project and add it to your solution.

Under the solution view of this new WCF Application project, add a reference to WCF Library by "References->Add References->Projects", or by "References->Add References->Browser" to its DLL.

Under the solution view of the new project, delete IService1.cs, also delete Service1.svc.cs under Service1.svc because we will use service implementation from the WCF library. But keep Service1.svc.

Under the solution view of the new project, double click Service1.svc to open it, replace its following marker line:

<%@ ServiceHost Language="C#" Debug="true" Service="WcfWebService.Service1" 
CodeBehind="Service1.svc.cs" %> 

with

<%@ ServiceHost Language="C#" Debug="true" Service="WcfServiceLibrary.Service1" %>

You might need to change WcfWebService, WcfServiceLibrary and Service1 and use your real names to make it work.

Please let me know if this was helpful.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!