Using MvcMailer in WCF

We are creating an application that uses ASP.NET MVC4 for a web application and WCF for web services that access a shared data store.

The web application sends emails using MvcMailer, I was hoping that someone could point me to some resources that show how MvcMailer can be used from WCF (if the specified resources exist).

I went through: https://github.com/smsohan/MvcMailer/issues/44

I would rather not collapse my own code, but I am ready to go this route if there is no better solution.

Thank!

+5
source share
1 answer

, GitHub. , . , . -.

MvcMailer WCFService.

1) HttpContext

A) Web.Config

<system.serviceModel>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />   
</system.serviceModel>

B) .

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
//public class MyService
//{
//  ...
//}

2) Razor

A) 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) WCF.

System.Web.WebPages
System.Web.WebPages.Razor

C) , "" . :

Copy Local = true

! MvcMailer WCF!

+2

All Articles