Razor引擎库在Azure函数上引发错误 [英] Razor Engine Library throws error on azure function

查看:107
本文介绍了Razor引擎库在Azure函数上引发错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 RazorEngine 库,当我使用azure函数应用程序时会引发错误调用编译功能

I am using RazorEngine Library and it throws error in azure function app when I call compile function

service.Compile(name: "TemplateMaster", modelType: modelType);

例外

Message: The given path's format is not supported.
     at System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath)
       at System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath)
       at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
       at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String path)
       at System.Reflection.RuntimeAssembly.get_Location()
       at RazorEngine.Compilation.ReferenceResolver.UseCurrentAssembliesReferenceResolver.<>c.<GetReferences>b__0_0(Assembly a)
       at System.Linq.Enumerable.WhereArrayIterator`1.MoveNext()
       at System.Linq.Lookup`2.Create[TSource](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
       at System.Linq.GroupedEnumerable`3.GetEnumerator()
       at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
       at System.Linq.Enumerable.<ConcatIterator>d__59`1.MoveNext()
       at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
       at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
       at RazorEngine.Compilation.CompilerServiceBase.GetAllReferences(TypeContext context)
       at RazorEngine.Compilation.DirectCompilerServiceBase.Compile(TypeContext context)
       at RazorEngine.Compilation.DirectCompilerServiceBase.CompileTypeImpl(TypeContext context)
       at RazorEngine.Compilation.DirectCompilerServiceBase.CompileType_Windows(TypeContext context)
       at RazorEngine.Compilation.DirectCompilerServiceBase.CompileType(TypeContext context)
       at RazorEngine.Templating.RazorEngineCore.CreateTemplateType(ITemplateSource razorTemplate, Type modelType)
       at RazorEngine.Templating.RazorEngineCore.Compile(ITemplateKey key, Type modelType)
       at RazorEngine.Templating.RazorEngineService.CompileAndCacheInternal(ITemplateKey key, Type modelType)
       at RazorEngine.Templating.RazorEngineService.Compile(ITemplateKey key, Type modelType)
       at RazorEngine.Templating.DynamicWrapperService.Compile(ITemplateKey key, Type modelType)
       at RazorEngine.Templating.RazorEngineServiceExtensions.Compile(IRazorEngineService service, String name, Type modelType)

推荐答案

错误消息不言自明.传递的路径不正确.如果它是在运行时编译的动态视图,请向我们提供您正在使用的视图的路径的副本,以便我们帮助您识别问题.

The error message is self explanatory. The path being passed in is incorrect. If it's a dynamic view being compiled at runtime, please provide us with a copy of the path to the view you're using so we can help you identify the issue.

这篇关于Razor引擎库在Azure函数上引发错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆