Note that there are some explanatory texts on larger screens.

plurals
  1. POOrchard CMS WCF Service with ServiceRoute
    text
    copied!<p>I have configured a Orchard module to expose a service and have enabled it. I cannot work out the URL to use based on the following.</p> <p>Routes.cs</p> <pre><code>namespace OrchardRestService { using System.Collections.Generic; using System.ServiceModel.Activation; using Orchard.Mvc.Routes; using Orchard.Wcf; public class Routes : IRouteProvider { #region Implementation of IRouteProvider public IEnumerable&lt;RouteDescriptor&gt; GetRoutes() { return new[] { new RouteDescriptor { Priority = 20, Route = new ServiceRoute( "ContentService", new OrchardServiceHostFactory(), typeof(IContentService)) } }; } public void GetRoutes(ICollection&lt;RouteDescriptor&gt; routes) { foreach (var routeDescriptor in GetRoutes()) routes.Add(routeDescriptor); } #endregion } } </code></pre> <p>IContentService.cs:</p> <pre><code>namespace OrchardRestService { using System.ServiceModel; using Orchard; [ServiceContract] public interface IContentService : IDependency { [OperationContract] ContentResult GetContent(string contentPath); } } </code></pre> <p>ContentService.cs:</p> <pre><code>namespace OrchardRestService { using System.Collections.Generic; using System.ServiceModel.Activation; [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class ContentService : IContentService { public ContentResult GetContent(string contentPath) { var contentResult = new ContentResult { ContentValues = new Dictionary&lt;string, string&gt;(), Found = true, Path = contentPath }; return contentResult; } } } </code></pre> <p>I've tried to follow what Bertrand Le Roy has written <a href="https://stackoverflow.com/questions/5795632/orchard-mvc-wcf-service-url-with-area">here</a> and <a href="http://weblogs.asp.net/bleroy/archive/2011/04/20/orchard-1-1-what-s-in-it-for-developers.aspx" rel="nofollow noreferrer">here</a> but seem to be missing something.</p> <p>My code is .Net 4 by the way so no need for an SVC file.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload