2
votes

I have an Azure cloud project which makes use of mongodb worker roles. When running in the local emulator everything works fine, however when I deploy to an Azure staging area, the mongodb worker roles are stuck cycling and show a System.IO.FileNotFoundException. I connected to one of the virtual machines remotely and looked at the event viewer and found the following error:

An unhandled exception occurred. Type: System.IO.FileNotFoundException Process ID: 1936 Process Name: WaWorkerHost Thread ID: 4 AppDomain Unhandled Exception for role MongoDB.WindowsAzure.MongoDBRole_IN_0 Exception: Could not load file or assembly 'mswacdmi, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. at Microsoft.WindowsAzure.StorageClient.CloudDrive..ctor(Uri uri, StorageCredentials credentials) at Microsoft.WindowsAzure.StorageClient.CloudStorageAccountCloudDriveExtensions.CreateCloudDrive(CloudStorageAccount storageAccount, String pageBlobUri) at MongoDB.WindowsAzure.MongoDBRole.Utilities.GetMountedPathFromBlob(String localCachePath, String cloudDir, String containerName, String blobName, Int32 driveSize, CloudDrive& mongoDrive) in c:\Users\Matt\Software\AzurePrototype1\mongo-azure-master\src\MongoDB.WindowsAzure.MongoDBRole\Utilities.cs:line 78 at MongoDB.WindowsAzure.MongoDBRole.MongoDBRole.GetMongoDataDirectory() in c:\Users\Matt\Software\AzurePrototype1\mongo-azure-master\src\MongoDB.WindowsAzure.MongoDBRole\MongoDBRole.cs:line 255 at MongoDB.WindowsAzure.MongoDBRole.MongoDBRole.StartMongoD() in c:\Users\Matt\Software\AzurePrototype1\mongo-azure-master\src\MongoDB.WindowsAzure.MongoDBRole\MongoDBRole.cs:line 201 at MongoDB.WindowsAzure.MongoDBRole.MongoDBRole.OnStart() in c:\Users\Matt\Software\AzurePrototype1\mongo-azure-master\src\MongoDB.WindowsAzure.MongoDBRole\MongoDBRole.cs:line 91 at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeRoleInternal(RoleType roleTypeEnum) at Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.b__0() at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()

Why does this work locally and not on Azure? I don't understand much about assemblies and such, but I am learning as I go along. One of the things suggested online is to check the properties of references assemblies and set 'Copy Local' to true, I have tried this but still the same error.

1

1 Answers

1
votes

In your worker role project, Make sure you have a .NET reference to mswacdmi.dll with the Properties set Copy Local=true. When you publish - RDP to your Azure role instance to verify that your deployed role has the assembly in the /bin directory.

Also make sure you are targeting x64 - I found mswacdmi.dll at this path (Azure SDK 1.8):

C:\Program Files\Microsoft SDKs\Windows Azure.NET SDK\2012-10\bin\runtimes\storage\cloud\x64