weixin_39917046
2021-01-03 06:47Access denied exception with RazorEngine 3.5
Hi,
We're using RazorEngine to generate emails in an ASP.Net Web Application. Since updating our code to version 3.5, the template compiling fails with the following stack trace:
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
The easiest way to test this is simply to create a blank website in Visual Studio, add the RazorEngine package, and plug the basic "Hello World" sample template. With 3.4.x, the code will run just fine. I've tracked the error to the CompileType method, when the process tries to load the generated assembly in the Windows Temp folder.
C:\Windows\Temp\RazorEngine_grceyklj.1f1\CompiledRazorTemplates.Dynamic.RazorEngine_6aa243ea4a104b1f8d7036145a4c87a0.dll Event Class: File System Result: ACCESS DENIED Impersonating: DMZ\iusr_web
Note that our websites are using ASP.NET Impersonation, and the impersonated user is "iuser_web" ,from our DMZ domain. Giving this user read access to the C:\Windows\Temp\ folder on the local machines fix the problem, and the templates are generated correctly. However, I'm not sure if this is the right course of action, since this used to work perfectly in 3.4.x.
Is this a new requirement for 3.5 ?
Thanks, Shaun
该提问来源于开源项目:Antaris/RazorEngine
- 点赞
- 回答
- 收藏
- 复制链接分享
7条回答
为你推荐
- 为什么会出现这个异常 Access to the path 'D:\eeeee' is denied.”该怎么解决
- c#
- 4个回答
- Quartz.NET:运行PHP cmd行导致php_mssql.dll上的ACCESS DENIED?
- php
- 2个回答
- linux服务器启动项目报错Permission denied.
- 开发语言
- 2个回答
- 在PHP中使用cURL和x-www-form-urlencoded进行POST返回Access Denied
- curl
- post
- php
- 1个回答
- navicat 连接 远程mysql数据库 报1045 ACCESS DENIED错误
- mysql
- 3个回答