【问题标题】:Azure App Service: Could not load file or assembly Microsoft.Azure.Mobile.ServerAzure 应用服务:无法加载文件或程序集 Microsoft.Azure.Mobile.Server
【发布时间】:2016-03-29 10:48:08
【问题描述】:

我一直在尝试将我的应用程序的服务器端从 Azure 移动服务切换到 Azure 应用程序服务,以获得更好的薪酬规模灵活性。我终于让它在本地调试器上运行,但是当我部署到服务器时,我得到一个错误页面。我进入门户中的诊断程序并收到此错误。任何想法都会受到赞赏。

    Exception information:
    Exception type: FileLoadException
    Exception message: Could not load file or assembly 'Microsoft.Azure.Mobile.Server,
    Version=0.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
    or one of its dependencies. The located assembly's manifest definition does not match
    the assembly reference. (Exception from HRESULT: 0x80131040) at
    System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken,
    IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs,
    Int32 methodInstCount, ObjectHandleOnStack type) at
    System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken,
    RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
    at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments,
    Type[] genericMethodArguments) at System.Reflection.CustomAttribute.FilterCustomAttributeRecord
    (CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly,
    RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType,
    Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes,
    RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters,
    Boolean& isVarArg) at System.Reflection.CustomAttribute.GetCustomAttributes(
    RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount,
    RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes,
    Boolean isDecoratedTargetSecurityTransparent) at
    System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly,
    RuntimeType caType) at System.Reflection.RuntimeAssembly.GetCustomAttributes
    (Boolean inherit) at Owin.Loader.DefaultLoader.SearchForStartupAttribute
    (String friendlyName, IList`1 errors, Boolean& conflict) at
    Owin.Loader.DefaultLoader.GetDefaultConfiguration(String friendlyName, IList`1 errors)
    at Owin.Loader.DefaultLoader.LoadImplementation(String startupName, IList`1 errorDetails)
    at Owin.Loader.DefaultLoader.Load(String startupName, IList`1 errorDetails)
    at Microsoft.Owin.Host.SystemWeb.OwinBuilder.GetAppStartup() at
    Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint()
    at System.Threading.LazyInitializer.EnsureInitializedCore[T]
    (T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) at 
    Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context) at
    System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS
    (IntPtr appContext, HttpContext context, MethodInfo[] handlers) at
    System.Web.HttpApplication.InitSpecial(HttpApplicationState state,
    MethodInfo[] handlers, IntPtr appContext, HttpContext context) at
    System.Web.HttpApplicationFactory.GetSpecialApplicationInstance
    (IntPtr appContext, HttpContext context) at 
    System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext)

【问题讨论】:

    标签: c# .net azure azure-app-service-envrmnt


    【解决方案1】:

    如果可能,请通过 NuGet 检查您引用的包的版本并更新到最新版本。 Microsoft.Azure.Mobile.Service 的最后发布版本是 1.0.0.0。

    我认为您的依赖项之一正在尝试加载 0.1.0.0 dll 版本。

    如果更新 NuGet 包不会改变任何内容,您可以添加绑定重定向,以将所有对 0.1.0.0 的调用重定向到项目中引用的版本(请参阅:https://msdn.microsoft.com/fr-fr/library/eftw1fys(v=vs.110).aspx)。

    希望这会有所帮助,

    朱利安

    【讨论】:

      猜你喜欢
      • 2018-11-09
      • 1970-01-01
      • 2023-03-25
      • 1970-01-01
      • 1970-01-01
      • 2021-12-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多