问题
I am getting HttpCompileException when trying to access a razor view. Error log contains no information. The same deployment works on NGinx+FastCGI, but not on Apache+mod_mono.
I am not using the mod_mono AutoConfiguration because I have not (yet) found a way how to make it work.
This is my "manual" apache2.conf
configuration for mono:
MonoAutoApplication disabled
AddHandler mono .aspx .ascx .asax .ashx .config .cs .asmx .axd
MonoApplications "/:/var/www/MyAppName"
<Location />
SetHandler mono
</Location>
This is the error I am getting when trying to access a razor view:
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
I have looked as RazorPageHost.Compile in ServiceStack sources and I can see that HttpCompileException is thrown in case result from _codeDomProvider.CompileAssemblyFromDom
contains some Errors, which makes sense.
Is there some special configuration to make CodeDomProvider
work on mod_mono Apache-hosted ServiceStack applications?
EDIT: It looks like this is not specific to ServiceStack, other ASP.NET apps deployed to the same server have the same issue.
来源:https://stackoverflow.com/questions/20118595/httpcompileexception-external-exception-when-trying-to-access-razor-view-in-s