ASP.NET 5 Beta7 不再适用于 Azure 网站

ASP.NET 5 Beta7 doesn't work anymore on Azure WebSites

我有一个 ASP.NET 5 (vNext) 应用程序,刚从 beta5 迁移到 beta7,从 dnx451 迁移到 dnx46,我无法让它工作。 我的另一个应用程序在迁移后运行良好,我没有看到那个应用程序有任何差异,但发布后我一直遇到以下错误:

DirectoryNotFoundException: Could not find a part of the path 'D:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\Facades\System.Collections.Concurrent.dll'.

System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)


System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)


System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)


Microsoft.AspNet.Mvc.Razor.Compilation.RoslynCompilationService.<>c__DisplayClass15_0.<CreateMetadataFileReference>b__0(String _)


System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)


Microsoft.AspNet.Mvc.Razor.Compilation.RoslynCompilationService.CreateMetadataFileReference(String path)

我尝试了几种发布方式,我创建了一个新的网站,仍然是一样的 - 让它工作的唯一方法是注释掉 Startup.cs 中的以下内容:

        app.UseMvc(routes =>
        {
            //default
            routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}"
                    );
            routes.MapRoute(
                      name: "overrideRoute",
                      template: "{*url}",
                      defaults: new { action = "Index", controller = "Home" }
                      );
            //web api
            routes.MapRoute(
                  name: "apiRoute",
                  template: "api/{controller}/{action}/{bizObject}/{id?}"
                  );
        });

没有上面,我可以写

            app.Run(async context =>
            {
                context.Response.ContentType = "text/plain";
                await context.Response.WriteAsync("test");
            });

它可以工作,但显然我需要 MVC,我的其他类似应用程序也按预期工作。

有什么提示吗?

这是一个已知问题。您可以在此处跟踪错误 https://github.com/projectkudu/kudu/issues/1675

基本上@Dijkgraaf 是正确的。整个 facades 文件夹 (.NETFramework\v4.6\Facades\) 都丢失了,您无法解决这个问题。 Azure 必须为目标 4.6 的构建添加该文件夹才能工作。如果可以,您可以尝试降级到 dnx451 并查看它是否适合您,直到上述错误得到解决。如果您对 dnx46 有严重的依赖性,那么很遗憾,您只能等待。