我有一个使用Identity Server 4的asp.net核心MVC应用程序,它在本地运行良好。但是,当我将其部署到Azure应用服务(部署是基于签入自动执行所以没有手动步骤)时,应用程序无法按预期工作
我可以:
我不能:
我的配置方法并不是特别复杂:
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
答案 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