Consume a Windows Azure Service using ASP.NET

by Jagadish Pulakhandam on 12/28/2011 7:07:50 AM
Rated 0 from 0 votes
Brief: Video demonstration on how to consume a Windows Azure Service using ASP.NET Web Application
Posted to: Microsoft Azure Technologies
Add to DiggAdd to del.icio.usAdd to FURLAdd to RedditAdd to YahooAdd to BlinklistAdd to GoogleAdd to ma.gnoliaAdd to ShadowsAdd to Technorati

Attached video demonstrates the following:
  • Creating a new ASP.NET Web application using Visual Studio 2010
  • Adding a service reference to a hosted Windows Azure service (developed and deployed in previous posts)
  • Creating instance to proxy and accessing the service operations
NOTE:  Developing and testing the service used in this demonstration is covered in previous post.

Source Code:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebConsumer.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<head runat="server">
    <style type="text/css">
            width: 100%;
            width: 131px;
    <form id="form1" runat="server">
        <table class="style1">
                <td class="style2">
                    <asp:Label ID="Label1" runat="server" Text="Enter First No:"></asp:Label>
                    <asp:TextBox ID="txtFirstNo" runat="server"></asp:TextBox>
                <td class="style2">
                    <asp:Label ID="Label2" runat="server" Text="Enter Second No:"></asp:Label>
                    <asp:TextBox ID="txtSecondNo" runat="server"></asp:TextBox>
                <td class="style2">
                    <asp:Button ID="btnCalc" runat="server" onclick="btnCalc_Click"
                        Text="Calculate" />
                <td class="style2">
                    <asp:Label ID="lblMsg" runat="server"></asp:Label>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebConsumer
    public partial class WebForm1 : System.Web.UI.Page
        protected void Page_Load(object sender, EventArgs e)
        protected void btnCalc_Click(object sender, EventArgs e)
            var oSvcClient = new CalcSvcRef.Service1Client();
            int a = Convert.ToInt16(this.txtFirstNo.Text);
            int b = Convert.ToInt16(this.txtSecondNo.Text);
            this.lblMsg.Text = "Sum = " + Convert.ToString(oSvcClient.GetSum(a, b));

<?xml version="1.0"?>
  For more information on how to configure your ASP.NET application, please visit
        <compilation debug="true" targetFramework="4.0" />
                <binding name="BasicHttpBinding_IService1" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="None">
                        <transport clientCredentialType="None" proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="UserName" algorithmSuite="Default" />
            <endpoint address=""
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1"
                contract="CalcSvcRef.IService1" name="BasicHttpBinding_IService1" />

Join the .NET Code Central Community and join the discussion!
Signing-up is FREE and quick. Do it now, we want to hear your opinion

Rated 0 from 0 votes ( login  to rate)
DotnetKicks DotnetKicksDe DotNetShoutout

Attachments / Source Code
You need to Login or Join for FREE to download the following

Video/Screen Recording (may not have audio narration/annotations)
You need to Login or Join for FREE to download the following