次の方法で共有


Developing Web Services on IIS with Windows Server AppFabric

Much of the content and samples for AppFabric shows developing your web site and services in Visual Studio with the ASP.NET Development Server and then deploying the solution to IIS and AppFabric.  While this works great for many solutions, there may be cases where you want to use IIS/AppFabric in your development environment.

To get started you need to prepare your machine with IIS and the appropriate settings for Visual Studio 2010 development.  This article on iis.net has instructions for VS2008 but they work the same for VS2010.

Here are the step by step instructions to create a web service on IIS / AppFabric with Visual Studio 2010

 

Task 1 - Create Your Web Site in IIS with Visual Studio

  1. Run Visual Studio 2010 as Administrator – tip on Windows 7 you can Ctrl+Shift+Click on the Icon to run as administrator

    image

  2. Select File / New / Web Site…

    image

  3. In the lower-left corner of the new project dialog select the Web location HTTP

    image

  4. Browse to or enter the name of the web site.  In this case, I’m going to name it Website and click Ok to create the website.

  5. Open IIS Manager and you will now see the Website under your Default Web Site

Task 2 – Create and Test Your Web Service

  1. Right click on your project and select Add New Item…

  2. Select WCF Service from the list of templates

  3. Add your service using the default name Service.svc

    Note: You will notice that the service is a little different than it is when you use a web project.  There is a folder called App_Code that contains your .cs or .vb files and the .SVC file is in the root of the web site.

  4. Right click on the .SVC file and select View in Browser

    Note: The URI of your web service is https://localhost/WebSite/Service.svc

  5. Open a Visual Studio 2010 Command prompt and run the WCF Test Client to test your service

    C:\>WCFTestClient.exe

  6. In the WCF Test Client select File / Add Service and enter the URL to your web service https://localhost/WebSite/Service.svc

    image

  7. To Invoke your service, double click on the DoWork method in the left pane and click Invoke on the right pane. If you get a security warning click OK to proceed.

Task 3 – See Your Service in AppFabric

If you have installed and configured Windows Server AppFabric correctly you should now have some interesting information about your service available in IIS Manager.

  1. Open IIS Manager

  2. Navigate to your Website under Default Website

  3. Double click on the Services icon

    image 

  4. Click on your service and you will see more information about it in the lower pane

    image

  5. If you click on the Monitoring Statistics tab you can see information about how your service has been performing

    image

  6. Click the back button and then double click on the Endpoints Icon

    image

  7. Click on the endpoint and you will see information about the endpoint

    image

  8. Click the back button and double click on the AppFabric Dashboard Icon

    image

  9. The AppFabric Dashboard retrieves data from the monitoring store and provides information about services and workflows in the selected website.  In our case we tested our service so you can see in the WCF Call History that we have 1 completed call to Service.svc

    image

Nice – but there is so much more.  Next time we will consider how AppFabric helps to monitor your systems.

Comments

  • Anonymous
    April 21, 2010
    Very nice intro, looking forward to more.  Thanks!