Question

I'm getting this error when I call Windows Azure Role Environment. I've checked and DotNetOpenAuth.OAuth.Common.dll as Copy Local = True.

Any idea?

System.TypeInitializationException was caught HResult=-2146233036
Message=The type initializer for '' threw an exception.
Source=Microsoft.WindowsAzure.ServiceRuntime TypeName=
StackTrace: at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetLocalResource(String localResourceName) at Platform.Services.Api.Common.FileStorage.GetFilePath(String azureLocalResourceNameFromServiceDefinition, String blobContainer, String fileName) in d:\TFS Project\DEV\Platform\Platform.Development\Platform.Services.Api\Common\FileStorage.cs:line 16 at Platform.Services.Api.Controllers.ReportingController.PrintProcessInteraction(Int64 id) in d:\TFS Project\DEV\Platform\Platform.Development\Platform.Services.Api\Controllers\ReportingController.cs:line 217 InnerException: .ModuleLoadException HResult=-2146233088 Message=The C++ module failed to load while attempting to initialize the default appdomain.

   Source=msshrtmi
   StackTrace:
        at <CrtImplementationDetails>.ThrowModuleLoadException(String

errorMessage, Exception innerException) at .LanguageSupport.Initialize(LanguageSupport* ) at .cctor() InnerException: System.Runtime.Serialization.SerializationException HResult=-2146233076 Message=Unable to find assembly 'DotNetOpenAuth.OAuth.Common, Version=4.2.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246'. Source=mscorlib StackTrace: Server stack trace: at System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly() at System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo assemblyInfo, String name) at System.Runtime.Serialization.Formatters.Binary.ObjectMap..ctor(String objectName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[] typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader, Int32 objectId, BinaryAssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable) at System.Runtime.Serialization.Formatters.Binary._BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped record) 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.CrossAppDomainSerializer.DeserializeObject(MemoryStream stm) at System.Runtime.Remoting.Messaging.SmuggledMethodCallMessage.FixupForNewAppDomain() at System.Runtime.Remoting.Channels.CrossAppDomainSink.DoDispatch(Byte[] reqStmBuff, SmuggledMethodCallMessage smuggledMcm, SmuggledMethodReturnMessage& smuggledMrm) at System.Runtime.Remoting.Channels.CrossAppDomainSink.DoTransitionDispatchCallback(Object[] args) 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 System.AppDomain.get_Id() at .DoCallBackInDefaultDomain(IntPtr function, Void* cookie) at .DefaultDomain.Initialize() at .LanguageSupport.InitializeDefaultAppDomain(LanguageSupport* ) at .LanguageSupport._Initialize(LanguageSupport* ) at .LanguageSupport.Initialize(LanguageSupport* ) InnerException:

Was it helpful?

Solution

Windows Azure Runtime is doing something with DotNetOpenAuth (I don't know why... this seems really strange). To solve this, I've created a Startup Task that installs DotNetOpenAuth.OAuth.Common.dll into GAC (following this solution).

type .\GACUtils\DotNetOpenAuth.OAuth.Common.dll
type .\GACUtils\gacutil 
.\GACUtils\gacutil /nologo /i .\GACUtils\DotNetOpenAuth.OAuth.Common.dll 

exit /b 0

OTHER TIPS

Make sure you compile to x64 or Any CPU?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top