Mongodb辅助角色抛出System.IO.FileNotFoundException

标签 mongodb azure azure-worker-roles azure-storage

我有一个使用 mongodb 辅助角色的 Azure 云项目。在本地模拟器中运行时,一切正常,但是当我部署到 Azure 暂存区域时,mongodb 辅助角色陷入循环并显示 System.IO.FileNotFoundException。我远程连接到其中一台虚拟机并查看事件查看器,发现以下错误:

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()

为什么这在本地工作而不是在 Azure 上工作?我对程序集等不太了解,但我正在边学习边学习。网上建议的一件事是检查引用程序集的属性并将“复制本地”设置为 true,我已经尝试过此操作但仍然出现相同的错误。

最佳答案

在您的辅助角色项目中,确保您具有对 mswacdmi.dll 的 .NET 引用,且属性设置为 Copy Local=true 。当您发布 - RDP to your Azure role instance验证您部署的角色是否在 /bin 目录中具有该程序集。

还要确保您的目标是 x64 - 我在此路径中找到了 mswacdmi.dll (Azure SDK 1.8):

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

关于Mongodb辅助角色抛出System.IO.FileNotFoundException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15026680/

相关文章:

node.js - Mongoose 架构创建错误

javascript - MongoDB 中的 Promise 是什么?

node.js - NodeJS + MongoDB : Getting data from collection with findOne ()

azure - 在 azure 应用服务部署中查找 Azure 插槽位置

.net - 防止未处理的异常破坏 Azure 辅助角色

azure - 在 Azure 服务之间共享配置

c# - Mongo DB中的Upserting和Id问题

azure - Azure SQL 审核 blob 文件名是如何生成的?

Azure支持的terraform构建帐户时出错

mysql - 为什么我的辅助角色在 Azure 上使用了高达 99% 的 CPU?