改变现有的WCF项目,Azure项目 [英] Changing existing WCF project to Azure project

查看:120
本文介绍了改变现有的WCF项目,Azure项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个工作的WCF服务。
我想将它部署在Windows Azure上。
主机现有的WCF服务在Azure上
它写的是我应该做的项目上单击右键并选择一个选项。
但我没有在我的菜单这样的选项。
对于类型的项目,我可以与上述右击做出这样的转变?

I have a working WCF service. I want to deploy it on Windows Azure. There Host Existing WCF Service On Azure it is written, that I should make right-click on the project and choose an option. But I don't have such an option in my menu. For which types of projects I can make such transitions with right-click mentioned above?

推荐答案

首先,你必须检查在Visual Studio 2010中的项目类型,请确保您要部署的项目类型是WCF应用程序或WebApplication的的(托管WCF服务)。如果它是一个网站项目(托管WCF服务),您可以轻松地将其从Visual Studio中转换为web应用项目。

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.

如果你的项目是一个WCF库,那么你必须先托管在一个WCF应用程序或WebApplication的项目,然后才能将其部署到Windows Azure(甚至更好,直接在Windows Azure中WCFServiceRole或WebRole项目承载它)。

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).

然后,你必须安装最新的Windows Azure SDK,以便所有的Windows Azure功能都在开发机器上安装。而且你应该有添加Windows Azure的部署项目选项。

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.

要举办WCF库在WCF应用程序执行以下操作(应该是近在Windows Azure的WCFServiceRole项目相同的):

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

在Visual Studio 2010中,创建一个WCF应用程序项目,并将其添加到您的解决方案。

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

在这个新的WCF应用程序项目的解决方案来看,通过添加到WCF库的引用引用 - >添加引用 - >项目,或通过引用 - >添加引用 - >浏览器,以它的DLL。

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.

根据新项目的解决方案,查看,删除IService1.cs,同时删除Service1.svc.cs Service1.svc下,因为我们将用服务实现从WCF库。但请Service1.svc。

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.

根据新项目的解决方案视图中,双击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" %> 

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

您可能需要更改WcfWebService,WcfServiceLibrary和服务1,用你的真实姓名,使其工作。

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.

这篇关于改变现有的WCF项目,Azure项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆