部署的asp.net核心mvc应用程序无法在azure中浏览

时间:2016-11-21 09:47:14

标签: asp.net-mvc asp.net-core azure-web-sites identityserver4

我有一个使用Identity Server 4的asp.net核心MVC应用程序,它在本地运行良好。但是,当我将其部署到Azure应用服务(部署是基于签入自动执行所以没有手动步骤)时,应用程序无法按预期工作

我可以:

  • 从www根目录中访问静态文件
  • 访问.well-known / openid-configuration并查看返回的JSON

我不能:

  • 浏览主页并获取身份服务器欢迎页面
  • 查看任何MVC“页面”(例如,帐户/登录)

我的配置方法并不是特别复杂:

loggerFactory.AddConsole();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseIdentityServer();
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme,
                AutomaticAuthenticate = false,
                AutomaticChallenge = false
            });



            app.UseStaticFiles();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

但MVC方面似乎没有任何功能。当我浏览主页时,我只是找不到View:

An unhandled exception occurred while processing the request.
InvalidOperationException: The view 'Index' was not found. The following locations were searched:
/Views/Home/Index.cshtml
/Views/Shared/Index.cshtml

1 个答案:

答案 0 :(得分:4)

检查 string strCon =@"Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=DESKTOP-EIQ5MRF)(PORT=1521))) (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=XE))); User Id = system; Password = bluesky; "; 文件中的publishOptions部分 - 您的部分包含project.json小节。您需要添加相对路径到"视图"文件夹在这里。

include