HttpCompileException:尝试访问Apache + mod_mono上托管的ServiceStack中的razor视图时出现“外部异常”

时间:2013-11-21 10:38:38

标签: razor mono servicestack codedom mod-mono

我在尝试访问剃刀视图时遇到HttpCompileException。错误日志不包含任何信息。相同的部署适用于NGinx + FastCGI,但不适用于Apache + mod_mono。

我没有使用mod_mono AutoConfiguration,因为我还没有找到一种方法让它工作。

这是我对mono的“手动”apache2.conf配置:

MonoAutoApplication disabled
AddHandler mono .aspx .ascx .asax .ashx .config .cs .asmx .axd
MonoApplications "/:/var/www/MyAppName"
<Location />
    SetHandler mono
</Location>

这是我在尝试访问剃刀视图时遇到的错误:

System.Web.HttpCompileException: External exception
  at ServiceStack.Razor.Compilation.RazorPageHost.Compile () [0x00000] in <filename unknown>:0 
  at ServiceStack.Razor.Managers.RazorPageResolver.EnsureCompiled (ServiceStack.Razor.Managers.RazorPage page, IHttpResponse response) [0x00000] in <filename unknown>:0 
  at ServiceStack.Razor.Managers.RazorPageResolver.CreateRazorPageInstance (IHttpRequest httpReq, IHttpResponse httpRes, System.Object dto, ServiceStack.Razor.Managers.RazorPage razorPage) [0x00000] in <filename unknown>:0 
  at ServiceStack.Razor.Managers.RazorPageResolver.ResolveAndExecuteRazorPage (IHttpRequest httpReq, IHttpResponse httpRes, System.Object model, ServiceStack.Razor.Managers.RazorPage razorPage) [0x00000] in <filename unknown>:0 
  at ServiceStack.Razor.Managers.RazorPageResolver.ProcessRequest (IHttpRequest httpReq, IHttpResponse httpRes, System.Object dto) [0x00000] in <filename unknown>:0 
  at ServiceStack.WebHost.Endpoints.Formats.HtmlFormat+<>c__DisplayClass1.<SerializeToStream>b__0 (IViewEngine x) [0x00000] in <filename unknown>:0 
  at System.Linq.Enumerable.Any[IViewEngine] (IEnumerable`1 source, System.Func`2 predicate) [0x00000] in <filename unknown>:0 
  at ServiceStack.WebHost.Endpoints.Formats.HtmlFormat.SerializeToStream (IRequestContext requestContext, System.Object response, IHttpResponse httpRes) [0x00000] in <filename unknown>:0 
  at ServiceStack.WebHost.Endpoints.Extensions.HttpResponseExtensions.WriteToResponse (IHttpResponse response, System.Object result, ServiceStack.ServiceHost.ResponseSerializerDelegate defaultAction, IRequestContext serializerCtx, System.Byte[] bodyPrefix, System.Byte[] bodySuffix) [0x00000] in <filename unknown>:0 

我在ServiceStack源代码中看起来像是RazorPageHost.Compile,我可以看到,如果_codeDomProvider.CompileAssemblyFromDom的结果包含一些错误,则抛出HttpCompileException,这是有道理的。

是否有一些特殊的配置使CodeDomProvider能够处理mod_mono Apache托管的ServiceStack应用程序?

编辑:看起来这不是特定于ServiceStack,部署到同一服务器的其他ASP.NET应用程序也有同样的问题。

0 个答案:

没有答案