Windowsazure WebApp and WebService are deployed in a webrole at the same time.

Source: Internet
Author: User

Note: This article is for individual study reprint, original address: http://blog.csdn.net/zztfj/article/details/6740327

Recently, a windowsazure-related application was developed, and the application called a Wcfservice, and the Web and Wcfservice were deployed as webrole in the development process, but Close to the end of the customer requirements to save the cost of azure to consolidate the two deployments.

If you are a normal web app, you can create a Web site in IIS and use WebService as a virtual directory. The survey found that this is a new feature of Windows Azure v1.3: Full IIS, which allows developers to create multiple different applications in the same webrole. For more information about this URL, please refer to http://www.wadewegner.com/2011/02/running-multiple-websites-in-a-windows-azure-web-role/.

1. First, we first create a windowsazure solution with VS2010 and add two Webrole (WebApp and WebService).

2, in the solution to remove WebService this project, while the Fulliis under the roles directory WebService also deleted. Such as.

3. Add the WebService project to the solution by adding an existing project. Such as.

Note: The above deletion of the action, is to make Fulliis only one webrole (the purpose of this article is not to be in a webrole to deploy both WebApp and deploy WebService these two applications).

4, the implementation of WebService and WebApp business logic (omitted).

5, modify the Servicedefinition.csdef file, add a virtualapplication below the site. Please refer to the Csdef file configuration below.

[HTML]View PlainCopy
  1. <? XML version= "1.0" encoding="Utf-8"?>
  2. <servicedefinition name="Fulliis" xmlns= "http://schemas.microsoft.com/ServiceHosting/ 2008/10/servicedefinition ">
  3. <webrole name="WebApp">
  4. <Sites>
  5. <Site name="Web">
  6. <virtualapplication name="Services" physicaldirectory=". /webservice " /> <!--key parts --
  7. <Bindings>
  8. <Binding name= "Endpoint1" endpointname="Endpoint1" />
  9. </Bindings>
  10. </Site>
  11. </Sites>
  12. <endpoints>
  13. <inputendpoint name="Endpoint1" protocol="http" port=" />"
  14. </Endpoints>
  15. <Imports>
  16. <Import modulename="diagnostics" />
  17. </Imports>
  18. </webrole>
  19. </servicedefinition>

6, in VS2010, the direct F5 start, WebApp has been started. In this case, open the Administrative Tools-IIS Manager, and in IIS Manager you can see a virtual directory of services under this site, such as (picture of the Japanese system) Fulliis.webapp.

Packaging The Azure app generates a fulliis.cspkg release package that uploads the file to windowsazure and achieves the purpose of deploying multiple applications in one webrole through a virtual directory.

Note: In Windowsazure, it is best to select Windows Azure Guest OS 2.0 operating system, which is powered by Windows Server R2 and IIS 7.5.

Windowsazure WebApp and WebService are deployed in a webrole at the same time.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.