I am creating a ServiceStack based website using the Razor format engine. In the folder root of my project I have "default.cshtml", but attempting to navigate to the URL (on localhost) I receive a 302 redirect to default.cshtml and the following page:
Forbidden
Request.HttpMethod: GET
Request.PathInfo: /default.cshtml
Request.QueryString:
Request.RawUrl: /default.cshtml
Here is my 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();
}
}
And my web.config:
<appSettings>
<add key="ResetAllOnStartUp" value="True" />
<add key="webPages:Enabled" value="false" />
</appSettings>
<connectionStrings>
</connectionStrings>
<system.web>
<compilation targetFramework="4.5" debug="true">
<assemblies>
<add assembly="System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
<buildProviders>
<add extension=".cshtml" type="ServiceStack.Razor.CSharpRazorBuildProvider, ServiceStack.Razor" />
</buildProviders>
</compilation>
<pages controlRenderingCompatibilityVersion="4.0" />
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<handlers>
<!-- IIS7 -->
<add path="*" name="ServiceStack.Factory" type="ServiceStack.HttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />
</handlers>
</system.webServer>
<system.web.webPages.razor>
<!--<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />-->
<pages pageBaseType="ServiceStack.Razor.ViewPage">
<namespaces>
<add namespace="ServiceStack" />
<add namespace="ServiceStack.Html" />
<add namespace="ServiceStack.Razor" />
<add namespace="ServiceStack.Text" />
<add namespace="ServiceStack.OrmLite" />
<add namespace="OOMS.Web" />
</namespaces>
</pages>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc" />
</system.web.webPages.razor>
And of course the default.cshtml:
@{
}
<!doctype html>
<html lang="en-us">
<body>
Hello world
</body>
</html>
Why can't the Razor engine pick up my default content page?