ServiceStack Razor – 默认文档的“禁止”错误

我正在使用Razor格式引擎创建一个基于ServiceStack的网站。 在我的项目的文件夹根目录中我有“default.cshtml”,但是尝试导航到URL(在localhost上)我收到302重定向到default.cshtml和以下页面:

Forbidden Request.HttpMethod: GET Request.PathInfo: /default.cshtml Request.QueryString: Request.RawUrl: /default.cshtml

这是我的Global.asax.cs:

 public class AppHost : AppHostBase { public AppHost() : base("OOMS 2.0", typeof(OOMS.ServiceInterface.OOMSService).Assembly) { } public override void Configure(Container container) { Plugins.Add(new RazorFormat()); Plugins.Add(new RequestLogsFeature()); } } public class Global : System.Web.HttpApplication { protected void Application_Start(object sender, EventArgs e) { new AppHost().Init(); } } 

我的web.config:

                          <!---->             

当然还有default.cshtml:

 @{ }    Hello world   

为什么Razor引擎无法获取我的默认内容页面?

这最终似乎是一些糟糕的缓存DLL或设置。 解决的步骤:

  • 通过将?debug=requestinfo ”附加到URL,在显示“Forbidden”的页面上分析调试信息。 这是ServiceStack在线文档中描述的一个方便工具。
  • 停止IIS Express并关闭Visual Studio。
  • 通过删除C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files的内容清除临时ASP.Net文件
  • 删除并重新安装了两个有问题的NuGet软件包, Microsoft.AspNet.WebPagesServiceStack.Razor
  • 清洁和重建,以及幸福。