在非 MVC 或基于 Web 的项目中使用 Postal

发布于 2024-11-25 15:36:27 字数 930 浏览 1 评论 0原文

我们正在开发一个 Windows 服务,它在给定的时间需要发送电子邮件。我们正在尝试使用 Postal ( https://github.com/andrewdavey/postal ) 来渲染一些模板。

我们现在面临的问题应该是缺少配置。这是错误消息:

D:\SVNV3\SalesCompensation\trunk\SalesCompensation.Application.Tests\Templates\Emails\NoSePudoCompensar.cshtml: ASP.NET 运行时错误:没有为该注册的构建提供程序 扩展名“.cshtml”。您可以在 machine.config 或 web.config 中的部分。 确保具有 BuildProviderAppliesToAttribute 属性 包括值“Web”或 '全部'。 D:\SVNV3\SalesCompensation\trunk\SalesCompensation.Application.Tests\Templates\Emails\NoSePudoCompensar.cshtml 1 1 SalesCompensation.Application.Tests

我找不到正确的配置!尝试时我得到同样的结果:

 <compilation>
     <buildProviders>
       <add extension=".cshtml"
 type="System.Web.WebPages.Razor.RazorBuildProvider,
 System.Web.WebPages.Razor"/>
     </buildProviders>   </compilation>

We are working on a Windows Service, 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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

压抑⊿情绪 2024-12-02 15:36:27

试试这个:

<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>

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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文