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
Run Visual Studio 2010 as Administrator – tip on Windows 7 you can Ctrl+Shift+Click on the Icon to run as administrator
Select File / New / Web Site…
In the lower-left corner of the new project dialog select the Web location HTTP
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.
Open IIS Manager and you will now see the Website under your Default Web Site
Task 2 – Create and Test Your Web Service
Right click on your project and select Add New Item…
Select WCF Service from the list of templates
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.
Right click on the .SVC file and select View in Browser
Note: The URI of your web service is https://localhost/WebSite/Service.svc
Open a Visual Studio 2010 Command prompt and run the WCF Test Client to test your service
C:\>WCFTestClient.exe
In the WCF Test Client select File / Add Service and enter the URL to your web service https://localhost/WebSite/Service.svc
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.
Open IIS Manager
Navigate to your Website under Default Website
Double click on the Services icon
Click on your service and you will see more information about it in the lower pane
If you click on the Monitoring Statistics tab you can see information about how your service has been performing
Click the back button and then double click on the Endpoints Icon
Click on the endpoint and you will see information about the endpoint
Click the back button and double click on the AppFabric Dashboard Icon
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
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!