none
"On this system, the Development Fabric supports AnyCPU and x64." How to configure the Development Fabric to support x86?

    Question

  • Hello, I'm very new to Azure, so please forgive the simple question.  

    I'm trying to create my first Azure WorkerRole, my dev machine is x64 Vista. I need to reference an x86 .dll in my project. In order to load the .dll I have to compile the WorkerRole for x86. 

    However when I set the Target CPU to x86, I get the folowing error:

     ---------------------------

    Microsoft Visual Studio

    ---------------------------

    Windows Azure Tools for Microsoft Visual Studio

     

    Cannot start debugging. The role Foo_WorkerRole was built for a platform incompatible with the Development Fabric.  On this system, the Development Fabric supports AnyCPU and x64.

    ---------------------------

    OK   

    ---------------------------

     

    Surely it must be possible to somehow reference an x86 .dll on a x64 OS?

     

    Please help! Thank you :)


    wiz developer
    • Moved by SrikumarV Wednesday, September 29, 2010 12:15 AM Migration (From:Windows Azure AppFabric)
    Friday, April 30, 2010 12:19 AM

Answers

  • Hello, you can't compile a Web/Worker Role assembly against x86. This is not supported in the cloud.

    On an x64 machine (such as a Windows Azure cloud machine), you can perform the following tasks:

    • Start a 32 bit process. (x86 exe)
    • Start a 64 bit process. (x64 exe, such as WaWeb/WorkerHost, the process that hosts your Web/Worker Role)
    • Invoke a 32 bit dll from a 32 bit process.
    • Invoke a 64 bit dll from a 64 bit process.
    • Invoke a .NET assembly compiled against Any CPU from a 32 bit process.
    • Invoke a .NET assembly compiled against Any CPU from a 64 bit process.
    • Invoke a WCF service hosted in a 32 bit process from another 64 bit process.
    • Invoke a WCF service hosted in a 64 bit process from another 32 bit process.

    But you can't do the following:

    • Invoke a 32 bit dll from a 64 bit process.
    • Invoke a 64 bit dll from a 32 bit process.

    Now in your situation, the hosting process (WaWeb/WorkerHost.exe) is a 64 bit process. So you can only invoke a 64 bit dll, or a .NET assembly compiled against Any CPU.

    If you have an existing 32 bit dll that you don't have source code (and thus cannot recompile agaisnt x64), you need to create an exe project (such as a console project) that is compiled against x86. You can lauch the x86 exe file as a 32 bit process on a 64 bit machine, and this 32 bit process can invoke your existing 32 bit dll. Then you can host a WCF service in the 32 bit process using NetNamedPipesBinding. In the main Web/Worker Role, which is 64 bit, you can invoke the WCF service instead of the 32 bit dll directly.

    Please refer to http://blogs.msdn.com/haniatassi/archive/2009/03/20/using-a-32bit-dll-in-the-windows-azure.aspx for a sample.


    Lante, shanaolanxing This posting is provided "AS IS" with no warranties, and confers no rights.
    • Marked as answer by Yi-Lun Luo Monday, May 10, 2010 8:01 AM
    Friday, April 30, 2010 1:26 AM

All replies

  • Hello, you can't compile a Web/Worker Role assembly against x86. This is not supported in the cloud.

    On an x64 machine (such as a Windows Azure cloud machine), you can perform the following tasks:

    • Start a 32 bit process. (x86 exe)
    • Start a 64 bit process. (x64 exe, such as WaWeb/WorkerHost, the process that hosts your Web/Worker Role)
    • Invoke a 32 bit dll from a 32 bit process.
    • Invoke a 64 bit dll from a 64 bit process.
    • Invoke a .NET assembly compiled against Any CPU from a 32 bit process.
    • Invoke a .NET assembly compiled against Any CPU from a 64 bit process.
    • Invoke a WCF service hosted in a 32 bit process from another 64 bit process.
    • Invoke a WCF service hosted in a 64 bit process from another 32 bit process.

    But you can't do the following:

    • Invoke a 32 bit dll from a 64 bit process.
    • Invoke a 64 bit dll from a 32 bit process.

    Now in your situation, the hosting process (WaWeb/WorkerHost.exe) is a 64 bit process. So you can only invoke a 64 bit dll, or a .NET assembly compiled against Any CPU.

    If you have an existing 32 bit dll that you don't have source code (and thus cannot recompile agaisnt x64), you need to create an exe project (such as a console project) that is compiled against x86. You can lauch the x86 exe file as a 32 bit process on a 64 bit machine, and this 32 bit process can invoke your existing 32 bit dll. Then you can host a WCF service in the 32 bit process using NetNamedPipesBinding. In the main Web/Worker Role, which is 64 bit, you can invoke the WCF service instead of the 32 bit dll directly.

    Please refer to http://blogs.msdn.com/haniatassi/archive/2009/03/20/using-a-32bit-dll-in-the-windows-azure.aspx for a sample.


    Lante, shanaolanxing This posting is provided "AS IS" with no warranties, and confers no rights.
    • Marked as answer by Yi-Lun Luo Monday, May 10, 2010 8:01 AM
    Friday, April 30, 2010 1:26 AM
  • Thank you very much for the detailed response. I will look in to the solutions you provided.

    Would loading an x86 OS on my development machine work? What is the real Azure cloud (non-development) fabric, x86, x64 or configurable? 

    Thanks again...

     

     


    wiz developer
    Friday, April 30, 2010 4:53 PM
  • Real cloud machines use 64 bit operating systems. But if your local OS is 32 bit, as long as you're doing managed only development, and all assemblies are compiled against Any CPU, it will also work.
    Lante, shanaolanxing This posting is provided "AS IS" with no warranties, and confers no rights.
    Tuesday, May 04, 2010 12:56 AM
  • Yi-Lun,

    Sorry to fire up an old thread but I would like to expand on your answer with another question.

    Why is Azure different than a regular x64 windows box? 

    I have an app that relies on x86 components.  So from my x64 dev box, I cannot compile "anycpu" or "x64" I have to go with x86.  The resulting app works fine on a regular x64 windows box thanks to Wow64

    Porting my app to Azure now requires me to use an x86 dev box.  Isn't Azure using Wow64 the same as windows, in order to run 32bit code on the 64bit OS?

    Using an x86 dev box is a nightmare for my company and a huge step back. We wish Wow64 worked the same way on Azure as it does for local windows systems.

    Is this likely to ever change?

    Thanks,

    Greg

    Thursday, August 12, 2010 11:10 PM