Using Postal in non MVC or web-based projects
We are working on a Windows Servic开发者_如何学编程e, which at a given time needs to send an e-mail. We are trying to use Postal ( https://github.com/andrewdavey/postal ) to render some templates.
The problem which we are facing now, is supposedly a missing config. Here is the error message:
D:\SVNV3\SalesCompensation\trunk\SalesCompensation.Application.Tests\Templates\Emails\NoSePudoCompensar.cshtml: ASP.NET runtime error: There is no build provider registered for the extension '.cshtml'. You can register one in the section in machine.config or web.config. Make sure is has a BuildProviderAppliesToAttribute attribute which includes the value 'Web' or 'All'. D:\SVNV3\SalesCompensation\trunk\SalesCompensation.Application.Tests\Templates\Emails\NoSePudoCompensar.cshtml 1 1 SalesCompensation.Application.Tests
I can't find the right config! I get the same when trying with:
<compilation>
<buildProviders>
<add extension=".cshtml"
type="System.Web.WebPages.Razor.RazorBuildProvider,
System.Web.WebPages.Razor"/>
</buildProviders> </compilation>
Try this :
<system.web>
<compilation>
<assemblies>
<add assembly="System.Web.WebPages.Razor, Version=1.0.0.0,Culture=neutral,PublicKeyToken=31BF3856AD364E35" />
</assemblies>
<buildProviders>
<add extension=".cshtml" type="System.Web.WebPages.Razor.RazorBuildProvider, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</buildProviders>
</compilation>
</system.web>
精彩评论