{"action":"created","issue":{"url":"https://api.github.com/repos/Antaris/RazorEngine/issues/527","repository_url":"https://api.github.com/repos/Antaris/RazorEngine","labels_url":"https://api.github.com/repos/Antaris/RazorEngine/issues/527/labels{/name}","comments_url":"https://api.github.com/repos/Antaris/RazorEngine/issues/527/comments","events_url":"https://api.github.com/repos/Antaris/RazorEngine/issues/527/events","html_url":"https://github.com/Antaris/RazorEngine/issues/527","id":343220409,"node_id":"MDU6SXNzdWUzNDMyMjA0MDk=","number":527,"title":"Could not resolve template","user":{"login":"tbconrad","id":7600376,"node_id":"MDQ6VXNlcjc2MDAzNzY=","avatar_url":"https://avatars2.githubusercontent.com/u/7600376?v=4","gravatar_id":"","url":"https://api.github.com/users/tbconrad","html_url":"https://github.com/tbconrad","followers_url":"https://api.github.com/users/tbconrad/followers","following_url":"https://api.github.com/users/tbconrad/following{/other_user}","gists_url":"https://api.github.com/users/tbconrad/gists{/gist_id}","starred_url":"https://api.github.com/users/tbconrad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbconrad/subscriptions","organizations_url":"https://api.github.com/users/tbconrad/orgs","repos_url":"https://api.github.com/users/tbconrad/repos","events_url":"https://api.github.com/users/tbconrad/events{/privacy}","received_events_url":"https://api.github.com/users/tbconrad/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-07-20T19:21:03Z","updated_at":"2018-07-26T17:12:19Z","closed_at":null,"author_association":"NONE","body":"I have a console application that uses RazorEngine to send email based on the run of the application. I am successfully able to send emails both in the development IDE and from running the console application via the executable. However, when I run the console application from a scheduled task I receive an error \"Could not resolve template\" on line,\r\n`var emailHtmlBody = Engine.Razor.RunCompile(\"ResponseErrors.cshtml\", null, model);`\r\n\r\nhas anyone run into this?\r\n\r\n```\r\n     var config = new TemplateServiceConfiguration\r\n     {\r\n        TemplateManager = new ResolvePathTemplateManager(new[] {\"EmailTemplates\"}),\r\n        DisableTempFileLocking = true\r\n     };\r\n\r\n     Engine.Razor = RazorEngineService.Create(config);\r\n     var emailHtmlBody = Engine.Razor.RunCompile(\"ResponseErrors.cshtml\", null, model);\r\n```\r\nUPDATE 1:\r\n\r\n- The server that is executing the scheduled task is the same server where the console app resides.\r\n- The account that is executing the console app in the Scheduled Task is a domain account with local admin rights to the server.\r\n\r\nUPDATE 2:\r\nThere is no RazorEngine... folder that was created in the user's temp folder.\r\n"},"comment":{"url":"https://api.github.com/repos/Antaris/RazorEngine/issues/comments/408168516","html_url":"https://github.com/Antaris/RazorEngine/issues/527#issuecomment-408168516","issue_url":"https://api.github.com/repos/Antaris/RazorEngine/issues/527","id":408168516,"node_id":"MDEyOklzc3VlQ29tbWVudDQwODE2ODUxNg==","user":{"login":"tbconrad","id":7600376,"node_id":"MDQ6VXNlcjc2MDAzNzY=","avatar_url":"https://avatars2.githubusercontent.com/u/7600376?v=4","gravatar_id":"","url":"https://api.github.com/users/tbconrad","html_url":"https://github.com/tbconrad","followers_url":"https://api.github.com/users/tbconrad/followers","following_url":"https://api.github.com/users/tbconrad/following{/other_user}","gists_url":"https://api.github.com/users/tbconrad/gists{/gist_id}","starred_url":"https://api.github.com/users/tbconrad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbconrad/subscriptions","organizations_url":"https://api.github.com/users/tbconrad/orgs","repos_url":"https://api.github.com/users/tbconrad/repos","events_url":"https://api.github.com/users/tbconrad/events{/privacy}","received_events_url":"https://api.github.com/users/tbconrad/received_events","type":"User","site_admin":false},"created_at":"2018-07-26T17:12:19Z","updated_at":"2018-07-26T17:12:19Z","author_association":"NONE","body":"So I was able to reproduce this. I created a sample console app and put it up on GitHub as [RazorEngine_Test](https://github.com/tbconrad/RazorEngine_Test). Compile and run the project and it will run successfully from the debug or release folder. Copy all the files from the folder you ran it from and paste them into a new folder then run it again.\r\n\r\n2018-07-26 12:57:22,991 INFO RazorEngine_Test.Logger Error Details: Could not resolve template ExceptionEmail.cshtml\r\nStack:    at RazorEngine.Templating.ResolvePathTemplateManager.ResolveFilePath(String name)\r\n   at RazorEngine.Templating.ResolvePathTemplateManager.GetKey(String name, ResolveType resolveType, ITemplateKey context)\r\n   at RazorEngine.Templating.RazorEngineService.GetKey(String cacheName, ResolveType resolveType, ITemplateKey context)\r\n   at RazorEngine.Templating.DynamicWrapperService.GetKey(String name, ResolveType resolveType, ITemplateKey context)\r\n   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)\r\n   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)\r\n   at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)\r\n   at RazorEngine_Test.TemplatedErrorEmail.SendExceptionEmail(ExceptionEmailClass exceptionEmailClass) in C:\\_Development\\personal\\RazorEngine_Test\\RazorEngine_Test\\Classes\\TemplatingErrorEmail.cs:line 23 \r\n"}}
{"actor":{"display_login":"tbconrad"}}