March, 2009

  • Cloudy in Seattle

    Now available: March CTP of the Windows Azure Tools and SDK

    • 6 Comments

    New release of the Windows Azure SDK and Tools!

    From now on, you only have to download the Windows Azure Tools for Microsoft Visual Studio and the SDK will be installed as part of that package.

    Windows Azure Tools for Microsoft Visual Studio (please give time for propagation or use the direct link to the download)

    In a nutshell, you can now run managed code Full Trust and if you want to give fastCGI applications on Windows Azure a try, you can do that too!

    Please install the following hotfixes:

  • Hotfix: Native Debugging Improvements
  • Hotfix: Support for FastCGI on the Development Fabric
  • What’s new in Windows Azure SDK

    • Support for developing Managed Full Trust applications. It also provides support for Native Code via PInvokes and spawning native processes.
    • Support for developing FastCGI applications, including support for rewrite rules via URL Rewrite Module.
    • Improved support for the integration of development storage with Visual Studio, including enhanced performance and support for SQL Server (only local instance). 

    What’s new in Windows Azure Tools for Visual Studio

    • Combined installer includes the Windows Azure SDK
    • Addressed top customer bugs.
    • Native Code Debugging.
    • Update Notification of future releases.
    • FastCGI template
  • Cloudy in Seattle

    Walkthrough: Enabling Full Trust to Call Native Code on Windows Azure

    • 4 Comments

    One of the cool new features in the Windows Azure Mix 09 CTP is the ability to run your Web and/or Worker Roles in full trust (non-admin).  This opens up all kinds of features that weren’t available in the previous CTPs.

    An interesting feature, which is the subject of this post is the ability to make PInvoke calls.

    One of the things I have noticed in playing with calling native code is that you have to be more aware of the actual environment in the cloud.  For example, Windows Azure in the cloud:

    • Runs your Cloud Services on an x64 Operating System.  The processes in which your role instances run are 64-bit processes.
    • Has the .Net Framework 3.5 SP1 redistributable installed, which includes a subset of the full Microsoft Visual C++ 2008 Redistributable (x64)

    I also want to reiterate here that your Role Instances run in separate VMs and those VMs can come and go – it’s important not to count on any file system persistence in the VM.

    1. Create a new Web Cloud Service project.  File | New | Project.  Select Visual C#/VB | Cloud Services | Web Cloud Services

    image

    2. Add a project to your solution for your native code. Right click on the Solution Explorer and select Add | New Project…

    image

    3. Select “Win32 Project” and call it “NativeCalc”

    image

    Setup the win32 project to be a DLL – we’ll just call a simple C function from it. Select “Export symbols”.

    image

    3. Open NativeCalc.h and change the dummy fnNativeCalc function to:

    extern "C"
    {
        NATIVECALC_API int AddNumbers(int left, int right);
    }

    Note that the extern “C” specifies to use C linkage convention – what you see for the exported symbol if you used dumpbin – instead of the C++ decorations.  This is what PInvoke will look for.

    4. Now implement the method in NativeCalc.cpp

    NATIVECALC_API int AddNumbers(int left, int right)
    {
        return left + right;
    }

    5. Next we have to ensure that this DLL is included as part of the Service Package.  See this post for more details. 

    First I set the output directory of the DLL to be in the Web Role project directory. 

    image

    I build all then right click on the nativeCloudService_WebRole project in Solution Explorer and select Add | Existing Item | NativeCalc.dll

    image

    I then set the CopyToOutputDirectory property to “CopyIfnewer”

    image

    6. Add a button and a label on default.aspx and in the button handler, set the label to the output of the native call:

    [DllImport("NativeCalc.dll")]
    static extern int AddNumbers(int left, int right);
    
    protected void Button1_Click(object sender, EventArgs e)
    {
        Label1.Text = AddNumbers(2, 3).ToString();
    }

    7. Set the enableNativeExecution attribute on the WebRole in the ServiceDefinition.csdef

    <?xml version="1.0" encoding="utf-8"?>
    <ServiceDefinition name="NativeCloudService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
      <WebRole name="WebRole" enableNativeCodeExecution="true">
        <InputEndpoints>

    8. Run the application and hit the button – everything will work as expected – you just called native code running on Windows Azure!

    9. If you want to publish and deploy this to the Cloud – make sure that the native DLL is being built in release mode and is built for x64.  See the troubleshooting section below for more details.

    Troubleshooting:

    Small troubleshooting section:

    • If you run and get a SecurityException, you forgot to set the enableNativeCodeExecution attribute to true.
    • Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
      Exception Details: System.Security.SecurityException: System.Security.Permissions.SecurityPermission

    When trying in the Cloud:

    • If you get an exception: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) 
    • You are trying to PInvoke to a 32-Bit DLL instead of a 64-bit DLL.  Remember what I said above: Windows Azure runs your Cloud Service on a 64 Bit Operating System. 
    • You can solve this by building your DLL for x64.  Otherwise, you’ll have to launch a 32-bit process that can make calls into your 32 Bit DLL.

    image

    • If you get an exception: Unable to load DLL <DLL>: The application failed to start because its side-by-side configuration is incorrect.  Please see the application event log for more detail. (Exception from HRESULT: 0x80073681). 
    • This could be many things, the most likely one is that you are missing a Visual C++ runtime dll on Windows Azure. 
    • The most common situation is if you uploaded a debug version of your native code dll – it uses the debug version of the VC++ runtime which has a different name and isn’t available on Windows Azure.  To solve this, either build release or deploy any necessary dlls with your Service Package.

    clip_image002

    Compiling for x64 in Visual Studio related:

    • To configure VS to build your NativeCalc DLL as x64, use the Configuration Manager and change the platform to x64. (notable if you are using a 32 bit Operating System)

    image

    • In order to be able to compile for x64, you may have to install the x64 compiler.  You can do this by going to Add/Remove programs, selecting Visual Studio and adding the “X64 Compiler and Tools” option

    image

  • Cloudy in Seattle

    Windows Azure Mix Videos

    • 3 Comments

    If you weren't able to make it to MIX09, you can catch videos of the sessions.

    My session is available for watching here: Using the Windows Azure Tools for Microsoft Visual Studio to Build Cloud Services

    If you haven't seen the keynotes, I highly recommend that you see them, lots of awesome announcements and they are pretty darn entertaining too.

    You can also catch the other Azure related sessions.

    Here's the list of Windows Azure sessions:

    Lots of great information available, hope you enjoy.

  • Cloudy in Seattle

    Updated Release Notes for the Windows Azure Tools March 2009 CTP

    • 2 Comments

    Update: We've refreshed the release and this new release resolves these issues.  See here for more information.

    We recently helped out a couple of folks on the Windows Azure Forum and felt it would be useful to post some information about two issues we’ve been seeing in the March 2009 CTP.

    Issue: Visual Studio closes unexpectedly when launching Help | About or creating a Cloud Service in some non ENU Operating Systems.

    Workaround: Modify (you might have to add it if it's not there) the value of the following key to "False":

    HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\Cloud Computing Tools\Update Notification\AutomaticUpdatesEnabled="False"

    Issue: if you specify the SQL instance to use for the Development Storage (through the DSInit command line utility in the SDK), the “Create Test Storage Tables” command will fail. 

    Workaround: Please replace the Microsoft.CloudService.targets file with the file attached to this blog post

    This is useful for people that wish to use a different SQL Server instance other than SQL Server Express.

    You can find the Microsoft.CloudService.Targets file to replace in your C:\Program Files (x86)\MSBuild\Microsoft\Cloud Service\v1.0 directory. 

    Hope this helps, stay tuned for more information.

  • Cloudy in Seattle

    Windows Azure Tools session at Mix '09 - Come on down!

    • 2 Comments

    For those of you who are attending Mix '09, it'd be great if you could come check out my tools talk on Windows Azure: https://content.visitmix.com/2009/Speakers/ (click on "Azure")

    MIX09-T81M Using the Windows Azure Tools for Microsoft Visual Studio to Build Cloud Services
    Friday March 20 |9:25 AM-9:45 AM | San Polo 3401
    By: Jim Nakashima  Tags: ASP.NET | Azure
    Come hear how to use the Windows Azure Tools for Visual Studio to more easily create, build, debug, deploy, run and package scalable services on Windows Azure.

    I really hope to see some of you there -- please come by to chat, I'd really like to get some first hand feedback about the Tools and Platform. 

    I should also mention, if you've seen Steve Marx talk, you know not to miss it, if you haven't, definitely check it out:

    MIX09-T09F Building Web Applications with Windows Azure
    Wednesday March 18 |4:00 PM-5:15 PM | San Polo 3504
    By: Steve Marx  Tags: Azure
    Come learn how to use Windows Azure to build a scalable Web application and deploy it to the cloud.

    Other Windows Azure sessions:

    MIX09-T07F Overview of Windows Azure
    Wednesday March 18 |2:15 PM-3:30 PM | San Polo 3504
    By: Manuvir Das  Tags: Azure
    Curious about cloud computing? Come learn how to use Windows Azure to better address key challenges of running Internet-scale applications in the cloud. Also hear about the essential concepts of Windows Azure, including what's new.

    MIX09-T38F See through the Clouds: Introduction to the Azure Services Platform
    Wednesday March 18 |11:30 AM-12:45 PM | San Polo 3504
    By: James Conrad  Tags: Azure
    Come hear how Microsoft is building a new platform for applications, and learn about the key services that compose the platform as well as how to get started. Also hear Microsoft's roadmap for the Azure Services Platform and learn about new features that will be added.

    MIX09-T08F Windows Azure Storage
    Thursday March 19 |10:30 AM-11:45 AM | San Polo 3504
    By: Brad Calder  Tags: Azure
    Come hear about the highly available and massively scalable cloud storage service that is provided by Windows Azure. Learn how to create and access the different types of Windows Azure storage available, including blobs, tables, and queues.

  • Cloudy in Seattle

    Updates to Windows Azure MVC Cloud Service for MVC RC2

    • 2 Comments

    [For more recent information on using ASP.NET MVC with Windows Azure please see this post.]

    ASP.Net MVC RC2 released a few days back and I've already gotten a number of requests to update the MVC on Windows Azure samples since they were getting a little stale.

    I updated my posts on MVC and I also added more detail to the original "MVC on Windows Azure" post by making it a walkthrough -- hopefully it will be easy for you to duplicate the steps on your projects.

    Also note that we've released a hotfix that will solve stability issues when using MVC with the Windows Azure Tools.

  • Page 1 of 1 (6 items)