Azure App Service:无法加载文件或程序集Microsoft.Azure.Mobile.Server

时间:2015-12-23 03:38:15

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

我一直在尝试将我的应用的服务器端从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)

1 个答案:

答案 0 :(得分: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)。

希望这有帮助,

于连