Resource not found for the segment Documents in Data Service Context RRS feed

  • Question

  • Hi All,

    Im' working with WCF Data Service Context. In the service i'm implementing some logic to filter my 'Documents' Entity using QueryInterceptor. While getting data no issues if there no recors for the filtering logic, but while adding a new item, i'm getting "

    Resource not found for the segment 'Documents'.

    I have tried to setting "svc.IgnoreResourceNotFoundException = true;" from Here and also set

    config.SetServiceOperationAccessRule("Documents", ServiceOperationRights.All);

    this is .svc. But still getting same exception.

    context.IgnoreResourceNotFoundException = true;  
    context.SetSaveStream(newDocument, file.InputStream, true, newDocument.ContentType, file.FileName);

    getting DataServiceRequestException.

    Any help,

    • Edited by Tirumalesh Tuesday, September 3, 2013 7:01 AM Spelling
    Thursday, August 29, 2013 11:57 AM

All replies

  • Hello, I tried some solutions, even then no success.


    Friday, September 13, 2013 7:07 AM
  • Looks like you need to set the EntitySetRights to all. Did you do that in the config?

    config.SetEntitySetAccessRule("Documents", EntitySetRights.All);
    Hope this helps.



    This posting is provided "AS IS" with no warranties, and confers no rights.

    Friday, September 13, 2013 4:12 PM
  • Thank you for your Response.
    I have already set that in my 'InitializeService' method like:

     config.SetEntitySetAccessRule("Documents", EntitySetRights.All);

    and tried :

    setting "svc.IgnoreResourceNotFoundException = true;"  also. But no luck.

    I read some where, if we write our filter logic in "OnQueryDocumnts()" (i.e QueryInterceptor of Documents), if there is no result found with that logic the service will return that "Resource not found for segment". Another post i see was, while we are trying to get results with the primary key filed of our entity where there is no results found for that key value, in that case also we may get to this Error.



    Monday, September 16, 2013 7:49 AM