Note that there are some explanatory texts on larger screens.

plurals
  1. POSharePoint 2013 and ASP.NET WebApi
    primarykey
    data
    text
    <p>I would like to use ASP.NET WebApi inside a SharePoint 2013 farm solution.</p> <p>I know it is not supported out-of-the-box, but I found <a href="http://melcher.it/2012/12/signalr-in-sharepoint-2013-the-real-time-web-is-coming/">SignalR can be run by means of a simple HttpModule</a>, so I was wondering whether a similar appoach could be used.</p> <p>Thanks in advance, Rich</p> <p><strong>UPDATE June 2013</strong></p> <p>Made it working by reworking the HTTP Module shown in the mentioned post:</p> <pre><code>config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "kms2013/api/{controller}/{action}", defaults: new { } ); config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always; config.Services.Replace(typeof(IAssembliesResolver), new SPAssemblyResolver()); HostingEnvironment.RegisterVirtualPathProvider(new WebAPIVirtualPathProvider()); </code></pre> <p><strong>SPAssemblyResolver</strong></p> <pre><code>public class SPAssemblyResolver : IAssembliesResolver { public ICollection&lt;Assembly&gt; GetAssemblies() { return new List&lt;Assembly&gt; { Assembly.GetExecutingAssembly() }; } } </code></pre> <p><strong>WebAPIVirtualPathProvider</strong></p> <p>Same as SignalRVirtualPathProvider shown in the post.</p> <p><strong>NEW ISSUE</strong></p> <p>The only problem with this approach is <em>ScriptResource.axd</em> and <em>WebResource.axd</em> now break when SP references them in a page. I tried to add an ignore route:</p> <pre><code>RouteTable.Routes.Add(new Route("{resource}.axd", new StopRoutingHandler())); </code></pre> <p>But I keep getting <em>401 Unauthorized</em>. Removing the module clears the error, so I guess we're still lacking one last piece of the puzzle.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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