Answered Problems using csrun to start emulator

  • Tuesday, June 14, 2011 6:47 PM
     
     

    I'm trying to run a Windows Azure deployment package in the Windows Azure Emulator, using the command line, with no success. My app consists of two roles, a web role and a worker role. It's 64 bit and using .NET Framework 4. I'm using Windwos Azure Sdk 1.4+refresh. I've created my package using cspack and start csrun:

        csrun.exe mypackage serviceconfiguration.cscfg

    The output follows:

        C:\Temp>csrun mypackage serviceconfiguration.cscfg
        Windows(R) Azure(TM) Desktop Execution Tool version 1.4.0.0
        for Microsoft(R) .NET Framework 3.5
        Copyright (c) Microsoft Corporation. All rights reserved.

        Using session id 2
        Attempting to bind SSL Certificate with identity sha1:<sha-hash>
        <id> for endpoint named Project.Web of role Endpoint2.
        Created: deployment(73)

        Deployment role instances not in "Started" state after 30 seconds.
        Deployment input endpoint Microsoft.WindowsAzure.Plugins.RemoteForwarder.RdpInput of role    
        Project.Web at tcp://127.0.0.1:3390/.
        Deployment input endpoint Endpoint2 of role Project.Web at https://127.0.0.1:444/

    The output in the Windwos Azure Compute Emulator follows:

        [MonAgentHost] Output: Monitoring Agent Started
        [Diagnostics]: Starting configuration channel polling
        [runtime] Role entrypoint could not be created:
        System.BadImageFormatException: Could not load file or     assembly 'file:///C:\Temp\mypackage\roles\Project.WorkerRole\approot\Project.WorkerRole.dll' or one     of its dependencies. This assembly is built by a runtime newer than the currently loaded     runtime and cannot be loaded.
        File name: 'file:///C:\Temp\mypackage\roles\Project.WorkerRole\approot\Project.WorkerRole.dll'
           at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
           at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
           at System.Reflection.Assembly.LoadFrom(String assemblyFile)
           at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.CreateRoleEntryPoint(RoleType roleTypeEnum)
           at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeRoleInternal(RoleType roleTypeEnum)
       
        Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll
     Running under executable  C:\Temp\mypackage\roles\Project.WorkerRole\base\x64\WaWorkerHost.exe

    So it fails to load the role entry point since it fails to loadmy assembly. The error message indicates that WaWorkerHost.exe is using .NET Framework 2.0 and fails to load my .NET Framework 4 assembly. Surely it must be possible to use CSrun.exe to deploy .NET Framework 4 packages to the Windows Azure Compute Emulator?


     (Reason I'm trying to do this is that I want to automate some tests)

     

All Replies

  • Tuesday, June 14, 2011 8:37 PM
     
     

    I just realized that it says "Windows(R) Azure(TM) Desktop Execution Tool version 1.4.0.0 for Microsoft(R) .NET Framework 3.5"

    Is there a version for .NET Framework 4 available? Or do I really have to target a .NET framework runtime version created over 5 years ago?!

    I'm using Windows 7, Visual Studio 2010 SP1 and the latest Azure SDK.

     


    Nitramafve
  • Wednesday, June 15, 2011 8:14 AM
    Moderator
     
     Answered

    Hi Nitramafve,

    > Surely it must be possible to use CSrun.exe to deploy .NET Framework 4 packages to the Windows Azure Compute Emulator?

    Surely we can deploy .NET Framework 4 packages using CSrun.exe but it needs our machine is 64 bit.

    WaWorkerHost.exe is built with .NET Framework 2.0. It can load .NET Framework assemblies because it has the following configuration in WaWorkerHost.exe.config file:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v4.0" />
      </startup>
      <runtime>
        <NetFx40_LegacySecurityPolicy enabled="false" />
      </runtime>
    </configuration>

    I can reproduce the same issue as yours by deleting that line. Could you please open C:\Temp\mypackage\roles\Project.WorkerRole\base\x64\ and check if WaWorkerHost.exe.config is correct or not? If you cannot find that file, please create a new one and input above configuration to see if it works.

    Thanks,


    Wengchao Zeng
    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework