HttpCompileException:“外部异常”试图访问ServiceStack Razor视

2019-10-19 01:01发布

试图访问一个Razor视图,当我得到HttpCompileException。 错误日志不包含任何信息。 相同的部署工作在nginx的FastCGI的+,而不是在Apache +是mod_mono。

我不使用的是mod_mono自动配置,因为我还没有(还)发现了一种如何使其发挥作用。

这是我的“手动” apache2.conf为单声道配置:

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

这是试图访问一个Razor视图时,我得到的错误:

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,我可以看到,HttpCompileException在结果的情况下抛出从_codeDomProvider.CompileAssemblyFromDom包含了一些错误,这是有道理的。

是否有一些特殊的配置,以CodeDomProvider上是mod_mono Apache的托管ServiceStack应用程序的工作?

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

文章来源: HttpCompileException: “External exception” when trying to access razor view in ServiceStack hosted on Apache+mod_mono