当我调用Windows Azure角色环境时,我收到此错误。 我已经检查过DotNetOpenAuth.OAuth.Common.dll作为Copy Local = True。
有什么想法吗?
发现System.TypeInitializationException HResult = -2146233036
Message =''抛出异常的类型初始值设定项 Source = Microsoft.WindowsAzure.ServiceRuntime TypeName =
堆栈跟踪: 在Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetLocalResource(String localResourceName) 在Platform.Services.Api.Common.FileStorage.GetFilePath(String azureLocalResourceNameFromServiceDefinition,String blobContainer, 字符串fileName)在d:\ TFS中 项目\ DEV \平台\ Platform.Development \ Platform.Services.Api \ COMMON \ FileStorage.cs:行 16 在Platform.Services.Api.Controllers.ReportingController.PrintProcessInteraction(Int64 id)在d:\ TFS中 项目\ DEV \平台\ Platform.Development \ Platform.Services.Api \ \控制器ReportingController.cs:行 217 InnerException:.ModuleLoadException 的HResult = -2146233088 Message =尝试初始化默认appdomain时无法加载C ++模块。Source=msshrtmi StackTrace: at <CrtImplementationDetails>.ThrowModuleLoadException(String
errorMessage,Exception innerException) at .LanguageSupport.Initialize(LanguageSupport *) ) at .cctor() InnerException:System.Runtime.Serialization.SerializationException 的HResult = -2146233076 消息=无法找到程序集'DotNetOpenAuth.OAuth.Common,Version = 4.2.0.0,Culture = neutral, 公钥= 2780ccd10d57b246' 。 来源= mscorlib程序 堆栈跟踪: 服务器堆栈跟踪: 在System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly() 在System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo) assemblyInfo,String name) 在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) 在System.Runtime.Serialization.Formatters.Binary ._ BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped) 记录) 在System.Runtime.Serialization.Formatters.Binary。 _BinaryParser.Run() 在System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler) handler,__BinaryParser serParser,Boolean fCheck,Boolean isCrossAppDomain,IMethodCallMessage methodCallMessage) 在System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream,HeaderHandler handler,Boolean fCheck,Boolean isCrossAppDomain,IMethodCallMessage methodCallMessage) 在System.Runtime.Remoting.Channels.CrossAppDomainSerializer.DeserializeObject(MemoryStream) STM) 在System.Runtime.Remoting.Messaging.SmuggledMethodCallMessage.FixupForNewAppDomain() 在System.Runtime.Remoting.Channels.CrossAppDomainSink.DoDispatch(Byte [] reqStmBuff,SmuggledMethodCallMessage走私了Mcm, SmuggledMethodReturnMessage&安培; smuggledMrm) 在System.Runtime.Remoting.Channels.CrossAppDomainSink.DoTransitionDispatchCallback(Object [] 参数) 在[0]处重新抛出异常: 在System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg) 在System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData,Int32类型) 在System.AppDomain.get_Id() at .DoCallBackInDefaultDomain(IntPtr函数, 虚空*饼干) at .DefaultDomain.Initialize() at .LanguageSupport.InitializeDefaultAppDomain(LanguageSupport *) ) at .LanguageSupport._Initialize(LanguageSupport *) ) at .LanguageSupport.Initialize(LanguageSupport *) ) 的InnerException:
答案 0 :(得分:0)
Windows Azure Runtime正在使用DotNetOpenAuth(我不知道为什么......这看起来很奇怪)。为了解决这个问题,我创建了一个启动任务,将DotNetOpenAuth.OAuth.Common.dll安装到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
答案 1 :(得分:-1)
确保编译为x64或任何CPU?