You don't need attributes based routing in this example. Convention based routing is built into WebAPI.
For the Delete method you can return an HttpStatusCode instead of throwing an exception.
public IHttpActionResult Delete(int Id)
{
var result = (from b in ourbooks
where b.Id == Id
select b).FirstOrDefault();
ourbooks.Remove(result);
return StatusCode(HttpStatusCode.Accepted);
}
Comments
You can allow non-administrator access using netsh[1] as an administrator. That way you don't need to run VS as admin.
You don't need attributes based routing in this example. Convention based routing is built into WebAPI.For the Delete method you can return an HttpStatusCode instead of throwing an exception.
Also check out the OWIN self host tutorial [2].[1] https://github.com/NancyFx/Nancy/wiki/Hosting-nancy-with-owi...
[2] http://www.asp.net/web-api/overview/hosting-aspnet-web-api/u...