【问题标题】:Shared DataContract Worker Role / Web RoleShared DataContract Worker 角色/Web 角色
【发布时间】:2013-01-04 15:51:34
【问题描述】:

我有一个 Azure Web 角色通过内部端点链接到工作角色,目的是使用工作角色向 Web 角色提供数据,保持 Web 角色和数据库之间的隔离 [其中包含敏感数据]。有一个类库项目,其中包含工作角色和 Web 角色引用的所有必要数据协定。

在开发环境中,一切都很好,而且效果很好。一旦我上传到 Azure,工作角色就无法启动。错误消息是:

Message string  Failed with ExceptionSystem.IO.FileNotFoundException: Could not load file or assembly 'ReadOnly_DC, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'ReadOnly_DC, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
   at System.Signature.GetSignature(SignatureStruct& signature, Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
   at System.Reflection.RuntimeMethodInfo.get_Signature()
   at System.Reflection.RuntimeMethodInfo.GetParameters()
   at System.ServiceModel.Description.ServiceReflector.ValidateParameterMetadata(MethodInfo methodInfo)
   at System.ServiceModel.Description.TypeLoader.CreateOperationDescriptions(ContractDescription contractDescription, ContractReflectionInfo reflectionInfo, Type contractToGetMethodsFrom, ContractDescription declaringContract, MessageDirection direction)
   at System.ServiceModel.Description.TypeLoader.CreateContractDescription(ServiceContractAttribute contractAttr, Type contractType, Type serviceType, ContractReflectionInfo& reflectionInfo, Object serviceImplementation)
   at System.ServiceModel.Description.TypeLoader.LoadContractDescriptionHelper(Type contractType, Type serviceType, Object serviceImplementation)
   at System.ServiceModel.Description.ContractDescription.GetContract(Type contractType, Type serviceType)
   at System.ServiceModel.ServiceHost.CreateDescription(IDictionary`2& implementedContracts)
   at System.ServiceModel.ServiceHostBase.InitializeDescription(UriSchemeKeyedCollection baseAddresses)
   at System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses)
   at DA_Worker.WorkerRole.StartWS_Host() in C:\Users\grant.roy\Documents\Visual Studio 2010\Projects\CraigAzure\DA_Worker\WorkerRole.cs:line 80

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
; TraceSource 'WaWorkerHost.exe' event

好像打不开Data Contract类库“ReadOnly_DC”。

对 ReadOnly_DC 的引用设置为复制本地,我已尝试对所有与数据协定类库一起使用的引用“复制本地”,但无济于事。

任何建议都非常感谢!

授予

【问题讨论】:

    标签: azure internal web-worker endpoints datacontracts


    【解决方案1】:

    确保在解决方案资源管理器中右键单击辅助角色项目时,在“项目依赖项...”中选择了类库。

    【讨论】:

    • Data Contract 类库设置为依赖项,但有一个 Yubikey(安全令牌)类库我忘记设置为依赖项。我现在已经这样做了,目前正在重新发布以防万一!! - 感谢您的建议。
    【解决方案2】:

    好的 - 我不敢相信这是答案,但这就是我让它工作的方式。我将各种类库中的所有逻辑直接移到了我的 Worker Role 项目中,毫不奇怪,它可以找到它需要的各种方法和数据协定,并且 Worker Role 开始工作了!!

    为了与 Web 角色共享“共享”资源,我通过解决方案资源管理器中的“添加现有项目”功能向 Web 角色添加了必要的类 [数据协定、YubiKey-Class 和 IWebService 本身],添加它们作为“链接”而不是文件的重复副本。

    因此,这将我的 [隐藏] woker 角色中的所有秘密内容 [连接字符串和共享存储访问密钥] 与我暴露在互联网上的 web 角色分开。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-10-25
      • 1970-01-01
      • 1970-01-01
      • 2012-02-04
      • 2018-03-03
      • 1970-01-01
      • 2013-11-07
      • 2013-08-22
      相关资源
      最近更新 更多