CSPack RemotingException while packaging Cloud service project with MSBuild - powershell

I have a powershell script that is packaging our builds and deploys them to Azure Cloud Services. This script was running without any problem with SDK 2.3, but when we upgraded to SDK 2.5 we started receiving the following error while building the project:
CorePublish:
CorePublish: PackageWebRole = True
Publishing starting...
RolePlugins is
Importedmodules is
Publishing to 'bin\Release\app.publish\'
Creating directory "bin\Release\app.publish\".
TargetServiceDefinition is bin\Release\ServiceDefinition.csdef
TargetServiceConfiguration is bin\Release\ServiceConfiguration.cscfg
Roles is E:\Preview\temp\Azure\obj\Release\App\
error MSB4018: The "CSPack" task failed unexpectedly.
System.Runtime.Remoting.RemotingException: Object '/54628d54_42c6_4d39_bc4c_958b6bfaeb90/6y8efa6v6y8omskqeetyix8g_4.rem' has been disconnected or does not exist at the server.
at System.IO.FileStream.get_CanRead()
at MS.Internal.IO.Zip.ZipIOLocalFileBlock.CheckFileAccessParameter(Stream stream, FileAccess access)
at MS.Internal.IO.Zip.ZipIOLocalFileBlock.GetStream(FileMode mode, FileAccess access)
at System.IO.Packaging.ZipPackagePart.GetStreamCore(FileMode mode, FileAccess access)
at System.IO.Packaging.PackagePart.GetStream(FileMode mode, FileAccess access)
at Microsoft.ServiceHosting.Tools.Packaging.Utils.CopyFullStreamToPart(Stream source, PackagePart part, PackageManifest manifest)
at Microsoft.ServiceHosting.Tools.Packaging.PackageCreator.CreateRolePackages(ModelProcessor modelProcessor, PackageManifest applicationManifest, Package applicationPackage)
at Microsoft.ServiceHosting.Tools.Packaging.PackageCreator.CreatePackage(Stream outputStream, Action`1 postProcess, PackageRestrictions restrictions)
at Microsoft.ServiceHosting.Tools.Packaging.ServiceApplicationPackage.CreateServiceApplicationPackage(String serviceModelFileName, String serviceDescriptionFile, Stream output, IPackageSecurity encrypt, Dictionary`2 namedStreamCollection, String userInfo, EventHandler`1 rolePackagePartAddedHandler)
at Microsoft.ServiceHosting.Tools.MSBuildTasks.PackageCreator.CreateServiceApplicationPackage(String serviceRdFilePath, String processedServiceDefinitionFile, FileStream packageStream, Dictionary`2 namedStreams, Dictionary`2 rolesDictionary)
at Microsoft.ServiceHosting.Tools.MSBuildTasks.PackageCreator.CreateServiceApplicationPackage(String serviceRdFilePath, String processedServiceDefinitionFile, FileStream packageStream, Dictionary`2 namedStreams, Dictionary`2 rolesDictionary)
at Microsoft.ServiceHosting.Tools.MSBuildTasks.CSPack.TryCreatePackage(ServiceDefinitionModel sm)
at Microsoft.ServiceHosting.Tools.MSBuildTasks.CSPack.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()
It is running on Windows Server 2008 R2, using MSBuild from VS2013 and the MSBuild is runnin like this parameters (from powershell):
& $msBuildPath "$tempPath\Azure\Azure.ccproj" /p:TargetProfile=Cloud /p:Configuration=Release /target:publish /flp:"Verbosity=quiet;logfile=E:\AzurePreview\msbuild.log"
I could not find anything connected to this issue.
I even tried to remove all traces of VS, SDKs and tools that might be connected to powershell, VS or Azure in general and installed the necessary parts again rebut nothing helped.
Could you please help me resolve this issue?

After discussing this issue with Microsoft support, I was able to package the project using CSPack command line tool, so I'm using this as a workaround.
Edit:
This issue seems fixed in Azure SDK 2.7

Related

Apache Ignite crash on startup

I'm using Apache Ignite entity framework Nuget as a second level cache in an ApsNetCore 2.0 web application under IIS(as reverse proxy).
On my development machine (VS2017 Windows 8.1) everything works well. Wen i deploy to WindowsServer 2012 the Ignite crash at startup with :
An error occurred while starting the application.
IgniteException: Failed to load jvm.dll (Please specify IgniteConfiguration.JvmDllPath or JAVA_HOME.)
Apache.Ignite.Core.Impl.Unmanaged.Jni.JvmDll.Load(string configJvmDllPath, ILogger log)
TargetInvocationException: Exception has been thrown by the target of an invocation.
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, bool publicOnly, bool noCheck, ref bool canBeCached, ref RuntimeMethodHandleInternal ctor, ref bool bNeedSecurityCheck)
IgniteException: Failed to load jvm.dll (Please specify IgniteConfiguration.JvmDllPath or JAVA_HOME.)
Apache.Ignite.Core.Impl.Unmanaged.Jni.JvmDll.Load(string configJvmDllPath, ILogger log)
Apache.Ignite.Core.Ignition.Start(IgniteConfiguration cfg)
Apache.Ignite.EntityFramework.IgniteDbConfiguration.GetOrStartIgnite(IgniteConfiguration cfg)
Apache.Ignite.EntityFramework.IgniteDbConfiguration..ctor()
I checked and re-chewed, installed the JDK , correct system variables....everything. The error don't goes away. What is interesting is the application run ok as console. When it runs under IIS(reverse proxy) it crashes at startup with the above error.
Any suggestions ?
Thank you
I managed to start the website. How ? Only with JDK 11 and explicit path to jvm.dll on app.config file:
If is not explicit in config then crashes.
The JAVA_HOME from system variable is correct set. Also the Path variable is
%JAVA_HOME%;%JAVA_HOME%\bin;%JAVA_HOME%\bin\server;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0;C:\Program Files\Microsoft\Web Platform Installer;C:\Program Files\dotnet;C:\Program Files (x86)\dotnet;C:\ProgramData\chocolatey\bin;C:\Program Files\Memurai;C:\Program Files\Java\jdk-15.0.1\bin\
Maybe is a conflict with C:\Program Files\Java\jdk-15.0.1\bin\ ? It carsh with jvm 15. But it works with jvm 11
Looks like the IIS worker process is running in 32-bit mode, so Ignite looks for a 32-bit JDK, which is not present.
And the console app runs in 64-bit mode, using 64-bit JDK, so it works.
Please check the app pool settings in IIS Manager -> Application Pools -> select the app pool you want and -> Advanced Settings.
Additionally, you can enable detailed logging to a file (since you can't see console logs in IIS) - Ignite logs all attempts to resolve the JDK path. For example, with Apache.Ignite.NLog package:
var nlogConfig = new LoggingConfiguration();
var fileTarget = new FileTarget
{
FileName = "/home/pavel/w/ignite_nlog.log"
};
nlogConfig.AddTarget("logfile", fileTarget);
nlogConfig.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, fileTarget));
LogManager.Configuration = nlogConfig;
var igniteConfig = new IgniteConfiguration
{
Logger = new IgniteNLogLogger()
};
Ignition.Start(igniteConfig);
I've checked the suggested points by Pavel Tupitsyn:
App pool aplication is 64bits (emable 32bits=false)
I've installed apache.Ignite.NLog
I'tested it on my machine and it logs well all java resolves.
I've deployed to windows server 2012 and under IIS i'm getting 'Process Failure'.
The log file looks like:
2020-12-07 19:39:38.3304|DEBUG||Starting Ignite.NET 2.9.0.50002
2020-12-07 19:39:38.3834|WARN||GC server mode is not enabled, this could lead to less than optimal performance on multi-core machines (to enable see http://msdn.microsoft.com/en-us/library/ms229357(v=vs.110).aspx).
2020-12-07 19:39:46.2534|DEBUG||Starting Ignite.NET 2.9.0.50002
so...just a warning (present on my machine too).
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info:
Apache.Ignite.Core.Common.IgniteException
at Apache.Ignite.Core.Impl.Unmanaged.Jni.JvmDll.Load(System.String, Apache.Ignite.Core.Log.ILogger)
at Apache.Ignite.Core.Ignition.Start(Apache.Ignite.Core.IgniteConfiguration)
at Nop.Web.Program.Main(System.String[])
well...adding apache.ingite.nlog throws PROCESS FAILURE
Hosting is virtual machine with Windows Server 2012 64bits
Any other ideas please....

Visual Studio Test task fails randomly without error message, Exit code 1 returned from process: node.exe

We have this issue that has been plaguing our engineering group for over a year and we cannot make any progress on the resolution. This question on Stack Overflow is eerily similar to what we experience.
We have several pipelines that use the "Visual Studio Test" task to run a set of NUnit tests from a single assembly. There are 1400-1500 unit tests in the project and it takes The NUnit Test Adapter is deployed via the NuGet task (install NUnit3TestAdapter). This test assembly is built with the following settings:
MSBuild Architecture=x86
Platform=AnyCPU
Configuration=Release
Strong Name Signed
Across multiple pipelines, this step randomly yet consistently ends early with zero error message or trace of why the process ended. Running a subsequent build of the pull request will often result in a success but occasionally another failure. In this case we have coined this a "flaky build" where given the same exact code inputs, the build can fail and then subsequently pass.
This is the only error message we received from the pipeline:
##[error]Exit code 1 returned from process: file name 'REDACTED\externals\node\bin\node.exe', arguments '"REDACTED_work_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\2.170.1\runvstest.js"'.
Finishing: Integration Tests
These tests are our "integration tests" that perform many setup steps to create a functional version of our system including creating a web server via Kestrel to host our API, connect to (localdb) running on the build server to restore a database .bak file and apply a database project (dacpac) as well as connect to Redis (also installed locally on the build server).
We are struggling to determine next steps so I am reaching out to the community to see if anyone else has suffered through this issue, has ideas for how to debug the issue or perhaps even a solution!
edit on 2020-11-10
Yesterday I set the pipeline variable system.debug to true and this is the output it captured during one of our flaky builds.
##[error\]Exit code 1 returned from process: file name 'E:\\servername\\externals\\node\\bin\\node.exe', arguments '"E:\\servername\\\_work\\\_tasks\\VSTest\_ef087383-ee5e-42c7-9a53-ab56c98420f9\\2.170.1\\runvstest.js"'.
##[debug\]Microsoft.VisualStudio.Services.Agent.Util.ProcessExitCodeException: Exit code 1 returned from process: file name 'E:\\servername\\externals\\node\\bin\\node.exe', arguments '"E:\\servername\\\_work\\\_tasks\\VSTest\_ef087383-ee5e-42c7-9a53-ab56c98420f9\\2.170.1\\runvstest.js"'.
at Microsoft.VisualStudio.Services.Agent.Util.ProcessInvoker.ExecuteAsync(String workingDirectory, String fileName, String arguments, IDictionary\`2 environment, Boolean requireExitCodeZero, Encoding outputEncoding, Boolean killProcessOnCancel, InputQueue\`1 redirectStandardIn, Boolean inheritConsoleHandler, Boolean keepStandardInOpen, Boolean highPriorityProcess, CancellationToken cancellationToken)
at Microsoft.VisualStudio.Services.Agent.ProcessInvokerWrapper.ExecuteAsync(String workingDirectory, String fileName, String arguments, IDictionary\`2 environment, Boolean requireExitCodeZero, Encoding outputEncoding, Boolean killProcessOnCancel, InputQueue\`1 redirectStandardIn, Boolean inheritConsoleHandler, Boolean keepStandardInOpen, Boolean highPriorityProcess, CancellationToken cancellationToken)
at Microsoft.VisualStudio.Services.Agent.Worker.Handlers.DefaultStepHost.ExecuteAsync(String workingDirectory, String fileName, String arguments, IDictionary\`2 environment, Boolean requireExitCodeZero, Encoding outputEncoding, Boolean killProcessOnCancel, Boolean inheritConsoleHandler, CancellationToken cancellationToken)
at Microsoft.VisualStudio.Services.Agent.Worker.Handlers.NodeHandler.RunAsync()
at Microsoft.VisualStudio.Services.Agent.Worker.TaskRunner.RunAsync()
at Microsoft.VisualStudio.Services.Agent.Worker.StepsRunner.RunStepAsync(IStep step, CancellationToken jobCancellationToken)

'sqlite3.dll was not loaded' when trying to install GitHub

I am trying to install GitHub using GitHubSetup.exe, downloaded from windows.github.com. The setup program 'downloads' what it needs, then closes and does nothing more.
Looking at TheLog.txt (in AppData/GitHub) shows the following:
2015-04-09 12:18:24.0747|ERROR|thread: 1|CrashManager|Dumping Loaded Module List
2015-04-09 12:18:24.0325|ERROR|thread: 1|CrashManager|Aieeeeeeee!
System.TypeInitializationException: The type initializer for 'NativeMethods' threw an exception. ---> System.Exception: sqlite3.dll was not loaded.
at SQLitePCL.SQLite3Provider.NativeMethods..cctor()
--- End of inner exception stack trace ---
at SQLitePCL.SQLite3Provider.NativeMethods.sqlite3_open_v2(Byte[] filename, IntPtr& db, Int32 flags, Byte[] vfs)
at SQLitePCL.SQLite3Provider.SQLitePCL.ISQLite3Provider.sqlite3_open_v2(String filename, IntPtr& db, Int32 flags, String vfs)
at Akavache.Sqlite3.Internal.SQLiteConnection..ctor(String databasePath, SQLiteOpenFlags openFlags, Boolean storeDateTimeAsTicks)
at Akavache.Sqlite3.Internal.SQLiteConnection..ctor(String databasePath, Boolean storeDateTimeAsTicks)
at Akavache.Sqlite3.SQLitePersistentBlobCache..ctor(String databaseFile, IScheduler scheduler)
at GitHub.Helpers.SqlitePersistentBlobCacheFactory.CreateBlobCache(String path)
at GitHub.Helpers.SharedCache.<>c__DisplayClass5.<.ctor>b__1()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at System.Lazy`1.get_Value()
at GitHub.Helpers.SharedCache.get_LocalMachine()
at GitHub.Helpers.AppLogManager.get_AnonymousIdentifier()
at GitHub.Helpers.HaystackTarget.Write(LogEventInfo logEvent)
at NLog.Targets.Target.Write(AsyncLogEventInfo logEvent)
2015-04-09 12:18:24.0747|ERROR|thread: 1|CrashManager|Inner Exception
System.Exception: sqlite3.dll was not loaded.
at SQLitePCL.SQLite3Provider.NativeMethods..cctor()
'sqlite3.dll was not loaded.' is also the error I get when I try to click on the GitHib shortcut that is placed on the desktop.
I am running Windows 8.1, 64 bit.
I have tried downloading a sqlite3.dll file and placing it in system32, but that does nothing. I have also explicitly told my firewall to allow connections for the setup program. I feel a little in over my head here - does anyone have any suggestions?
Please let me know if I need to provide any more information!
Thanks a lot!
Brendan here, one of the GitHub for Windows developers.
The latest update introduced a dependency that required a version of the Visual C++ Redistributable that wasn't installed as a pre-requisite. As a workaround, you can install the 32-bit version from here which adds it back in:
http://www.microsoft.com/en-us/download/details.aspx?id=30679

Unit testing with Roslyn.Services.Workspace results in a SecurityException while working at x86 target

I'm working on set of constants for my project, and I'd like to use roslyn to verify some of them in source code level. To achieve this, I'm loading entire solution using following snippet into AppDomain with IsFullyTrusted == true and IsHomogenous == true, i.e. remoting is enabled with x86 platform target:
// load workspace, i.e. solution from Visual Studio
var workspace = Roslyn.Services.Workspace.LoadSolution(solutionFile);
Test runners for NCrunch and NUnit with x86 platform with Roslyn
But while using either ncrunch 1.45 or nunit 2.6.2 nunit-console-x86.exe with platform configuration x86 as test runners, I'm constantly getting following System.Security.SecurityException:
System.Security.SecurityException : Type System.Runtime.Remoting.ObjRef and the types derived from it (such as System.Runtime.Remoting.ObjRef) are not permitted to be deserialized at this security level.
Server stack trace:
at System.Runtime.Serialization.FormatterServices.CheckTypeSecurity(Type t, TypeFilterLevel securityLevel)
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.CheckSecurity(ParseRecord pr)
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ParseObject(ParseRecord pr)
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Parse(ParseRecord pr)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped record)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryHeaderEnum binaryHeaderEnum)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryRequestMessage(String objectUri, Stream inputStream, Boolean bStrictBinding, TypeFilterLevel securityLevel)
at System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders, Stream& responseStream)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Roslyn.Utilities.RemoteServices.Initialize(Int32 clientProcessId)
at Roslyn.Utilities.RemoteServices.StartRemoteServicesProcess()
at Roslyn.Utilities.RemoteServices.get_Instance()
at Roslyn.Utilities.RemoteServices.CreateInstance[T]()
at Roslyn.Services.Host.TemporaryStorageServiceFactory.CreateService(IWorkspaceServiceProvider workspaceServices)
at Roslyn.Services.Host.WorkspaceServiceProviderFactory.<>c__DisplayClass6.<OnImportsSatisfied>b__1(IWorkspaceServiceProvider wsp)
at Roslyn.Services.Host.WorkspaceServiceProvider.ConstructService(Type type)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at Roslyn.Services.Host.WorkspaceServiceProvider.GetService[TWorkspaceService]()
at Roslyn.Services.SolutionServices..ctor(IWorkspaceServiceProvider workspaceServices)
at Roslyn.Services.Solution..ctor(SolutionId id, String filePath, VersionStamp version, VersionStamp latestProjectVersion, IWorkspaceServiceProvider workspaceServices)
at Roslyn.Services.Host.SolutionFactoryServiceFactory.SolutionFactoryService.CreateSolution(SolutionId id)
at Roslyn.Services.Host.TrackingWorkspace.CreateNewSolution(ISolutionFactoryService solutionFactory, SolutionId id)
at Roslyn.Services.Host.TrackingWorkspace..ctor(IWorkspaceServiceProvider workspaceServiceProvider, Boolean enableBackgroundCompilation, Boolean enableInProgressSolutions)
at Roslyn.Services.Host.HostWorkspace..ctor(IWorkspaceServiceProvider workspaceServiceProvider, Boolean enableBackgroundCompilation, Boolean enableInProgressSolutions, Boolean enableFileTracking)
at Roslyn.Services.Host.LoadedWorkspace..ctor(IWorkspaceServiceProvider workspaceServiceProvider, IDictionary`2 globalProperties, Boolean enableBackgroundCompilation, Boolean enableFileTracking)
at Roslyn.Services.Host.LoadedWorkspace.LoadSolution(String solutionFileName, String configuration, String platform, Boolean enableFileTracking)
at Roslyn.Services.Workspace.LoadSolution(String solutionFileName, String configuration, String platform, Boolean enableFileTracking)
There is a discussion on NCrunch forum, but I have tried all following options without success:
Add [assembly: AllowPartiallyTrustedCallers] to AssemblyInfo.cs
Add [assembly: SecurityRules(SecurityRuleSet.Level1)] to AssemblyInfo.cs
Add <NetFx40_LegacySecurityPolicy enabled="true" /> to app.config
Run VS2012 as Administrator
Decorate both unittests and implementation with [SecuritySafeCritical]
Update: create new AppDomain and provide
PermissionState.Unrestricted, SecurityPermissionFlag.AllFlags and DataProtectionPermissionFlags.AllFlags
Add Host Evidence: SecurityZone.MyComputer, System.Security.Policy.Hash and System.Security.Policy.StrongName
Add all assemblies (both mine and Roslyn CTP) to fullTrustAssemblies while creating of AppDomain
Update #2
This exception happens only while I'm running test under x86 configuration, after I had switched to x64 platform configuration, everything seems to work fine
Question
Are there any other attributes or configuration changes to app.config or AppDomain that could help to enable deserialization in .NET Framework remoting for System.Runtime.Remoting.ObjRef while running under x86 configuration?
Temporary solution
Switch to x64 build configuration only for unittest project(s)
Source code
Whole source code is available at github: to reproduce error run following unittest using NCrunch IntrospectionTests.Introspection_SearchForComplexityGt10_ApprovedList
Discussion at NCrunch forum
Additional information
Also I notice...
A lot of instances of Roslyn.Services.dll hang in background, after all tests had been completed.
Lack of Host Evidences for NCrunch: System.Security.Policy.Hash and System.Security.Policy.StrongName with test runner assembly name
resharper MSIL (should be x64 inside) and nunit 2.6.2 nunit-console.exe test runner are working fine, so it looks like Roslyn configuration/remoting/security configuration issue.
It looks like ncrunch is executing the tests in Partial Trust, whereas Resharper is running them in Full Trust.
Roslyn has not been tested in Partial Trust scenarios. There are likely to be accesses to APIs that require Full Trust.
I haven't used ncrunch, but maybe there is a way to configure it to run the tests in Full Trust?
I want to add something!
After upgrading an NUnit instance I manage to run to both 2.6.2 and 2.6.3 of the software, my team ran into similar issues with this exact System.Security exception that Akim was seeing.
We were creating an IpcChannel with some of our custom NUnit logic that wasn't created with the right trust settings, so we had to change something that looked like:
IpcChannel channel = new IpcChannel(string.Format("localhost:{0}", portNum));
To -
BinaryServerFormatterSinkProvider serverProvider = new BinaryServerFormatterSinkProvider();
serverProvider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
BinaryClientFormatterSinkProvider clientProvider = new BinaryClientFormatterSinkProvider();
var properties = new System.Collections.Hashtable();
properties["name"] = "ipc";
properties["priority"] = "20";
properties["portName"] = string.Format("localhost:{0}", portNum);
IpcChannel channel = new IpcChannel(properties, clientProvider, serverProvider);
Just a quick fix I noticed that I figured I would forward to anybody seeing something similar that can't just switch their platform settings. To be fair, it took me about four hours to figure out so I didn't want the knowledge to go to waste.

Mongodb worker role throws System.IO.FileNotFoundException

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.
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