Eri*_*rik 3 asp.net azure .net-assembly
我有一个非常简单的 ASP.NET 项目,当我从 Visual Studio 运行它时工作得很好,但是在我发布到 Azure Web App 后我收到了这个错误
无法加载文件或程序集“Microsoft.Owin.Security,Version=2.0.1.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35”或其依赖项之一。定位的程序集的清单定义与程序集引用不匹配。(来自 HRESULT 的异常:0x80131040)
我四处看了看,我没有使用——至少不是故意的——这个程序集,如果我在解决方案中进行搜索,它没有列在 Web.config 或 Package.config 或任何地方。
我真的不知道我在这里错过了什么。也许是 Azure 方面的配置。
这是堆栈跟踪
[FileLoadException: Could not load file or assembly 'Microsoft.Owin, Version=2.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)] SampleWebApp.Startup.ConfigureAuth(IAppBuilder app) +0 SampleWebApp.Startup.Configuration(IAppBuilder app) +5
[TargetInvocationException: Exception has been thrown by the target of an invocation.] System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0 System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +92 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +136 Owin.Loader.<>c__DisplayClass12.b__b(IAppBuilder builder) +66 Owin.Loader.<>c__DisplayClass1.b__0(IAppBuilder builder) +123 Microsoft.Owin.Host.SystemWeb.<>c__DisplayClass2.b__0(IAppBuilder builder) +71 Microsoft.Owin.Host.SystemWeb.OwinAppContext.Initialize(Action
1 startup) +462 Microsoft.Owin.Host.SystemWeb.OwinBuilder.Build(Action1 startup) +40 Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint() +70 System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +115 Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context) +106 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +537 System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +364 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +290[HttpException (0x80004005): Exception has been thrown by the target of an invocation.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +4531288 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +94 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +191
好的,我找到了问题的根源。
我以前有一个使用身份验证的 ASP.NET Web 应用程序 - 我不记得确切是哪一个。经过一些更改后,我发布到 Azure 并且一切正常。
后来,我改为使用令牌进行身份验证,因此我决定删除使用身份验证的现有 ASP.NET Web 应用程序并创建一个没有它的新应用程序。发布到 Azure 后,我开始收到上述问题中描述的错误。当然,我的新 Web 应用程序没有任何身份验证的参考,但我在没有删除以前的文件的情况下部署到 Azure。
所以,我所做的是再次发布,但这次在发布设置中,我单击“文件发布选项”并选中“在目的地删除其他文件”选项。我假设此选项会从我使用身份验证创建的第一个 Web 应用程序中删除任何现有文件和引用。现在我的新 Web 应用程序运行良好。
| 归档时间: |
|
| 查看次数: |
1434 次 |
| 最近记录: |