WCF Azure Silverlight Calculator

This sample creates a simple WCF calculator service and builds a Silverlight client for it. The client is then hosted alonside the service in the Azure fabric.

 
 
 
 
 
4 Star
(4)
5,454 times
Add to favorites
4/27/2011
E-mail Twitter del.icio.us Digg Facebook

Solution explorer

C#
VB.NET
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.diagnostics>
    <trace>
      <listeners>
        <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics">
          <filter type="" />
        </add>
      </listeners>
    </trace>
  </system.diagnostics>
  <connectionStrings />
  <system.web>
    <compilation debug="true" targetFramework="4.0">
    </compilation>
    <!--
          The <authentication> section enables configuration 
          of the security authentication mode used by 
          ASP.NET to identify an incoming user. 
        -->
    <authentication mode="Windows" />
    <!--
           The <customErrors> section enables configuration 
           of what to do if/when an unhandled error occurs 
           during the execution of a request. Specifically, 
           it enables developers to configure html error pages k
           to be displayed in place of a error stack trace.

           <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
             <error statusCode="403" redirect="NoAccess.htm" />
             <error statusCode="404" redirect="FileNotFound.htm" />
           </customErrors>
        -->
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" />
    <machineKey decryption="AES" decryptionKey="0CA3EFAF0F7A5E7A62681C0BF656EE0ECE31ACEE3E1023BA3FAD20EA5F199DE8" validation="SHA1" validationKey="7FCEC9F134D762EBBBA2518634E284416A7F55D59DE62168764FF0DCE537184F0535D5D9AD66DEDC97DC1ABFF7FA540B4DFD82E5BB196B95D15FF81F75AD5328" />
  </system.web>
  <!-- 
        The system.webServer section is required for running ASP.NET AJAX under Internet
        Information Services 7.0.  It is not necessary for previous version of IIS.
    -->
  <system.serviceModel>
    <bindings>
      <customBinding>
        <binding name="binaryHttpBinding">
          <binaryMessageEncoding />
          <httpTransport />
        </binding>
        <binding name="secureBinaryHttpBinding">
          <security authenticationMode="UserNameOverTransport" />
          <binaryMessageEncoding />
          <httpsTransport />
        </binding>
      </customBinding>
    </bindings>
    <!-- Ensure this setting is present for WCF to pick up base addresses correctly in Azure. -->
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    <behaviors>
      <serviceBehaviors>
        <!-- Only used by SilverlightCalculator sample -->
        <behavior name="SilverlightService.ServiceBehavior">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <!-- Only used by SilverlightCalculator sample -->
      <service behaviorConfiguration="SilverlightService.ServiceBehavior" name="SilverlightService.Service">
        <endpoint address="binary" binding="customBinding" bindingConfiguration="binaryHttpBinding" contract="SilverlightService.Service" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>
  </system.serviceModel>
</configuration>