Consume a Windows Azure Service using Windows Forms

by Jagadish Pulakhandam on 12/22/2011 12:37:46 PM
Rated 0 from 0 votes
Brief: Video demonstration on consuming a production (hosted) Windows Azure Service using Windows Forms
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 Windows Form application using Visual Studio 2010
  • Adding a service reference to Windows Azure service (developed and deployed in previous posts)
  • Creating instance to proxy and accessing the operations
NOTE:  Developing and testing the service used in this demonstration is covered in previous post.

Screenshot:



Source Code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
 
namespace WinFormsConsumer
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
 
        private void btnCalculate_Click(object sender, EventArgs e)
        {
            var oSvcClient = new CalcSvcRef.Service1Client();
            int a = Convert.ToInt16(this.txtFirst.Text);
            int b = Convert.ToInt16(this.txtSecond.Text);
            MessageBox.Show("Sum = " + Convert.ToString(oSvcClient.GetSum(a,b))) ;
        }
    }
}


<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <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"
                    useDefaultWebProxy="true">
                    <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" />
                    </security>
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://calcsvc.cloudapp.net/Service1.svc"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1"
                contract="CalcSvcRef.IService1" name="BasicHttpBinding_IService1" />
        </client>
    </system.serviceModel>
</configuration>


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
0

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