I was the guy who posted that issue on GitHub. There are no resources out there right now for doing that, so I had to figure it out myself. Here's the little guide I wrote to my co-workers. I should post it online somewhere.
How to allow MvcMailer to function in your WCFService.
1) Enable the HttpContext
A) Add the following to your Web.Config
<system.serviceModel> <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" /> </system.serviceModel>
B) Add the following attribute to your service class.
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] //public class MyService //{ // ... //}
2) Enable Razor
A) Add the following to your Web.Config
<system.web> <compilation debug="true" targetFramework="4.0"> <assemblies> <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> </assemblies> <buildProviders> <add extension=".cshtml" type="System.Web.WebPages.Razor.RazorBuildProvider, System.Web.WebPages.Razor"/> </buildProviders> </compilation> </system.web>
B) Add the following references to the WCF service project.
System.Web.WebPages System.Web.WebPages.Razor
C) Select the references, right click, and open Properties for them. Then set the following property:
Copy Local = true
Done! MvcMailer will now work in your WCF service!