locked
WCF Data Services + Application Request Routing RRS feed

  • Question

  • We are facing issues when we try to update/delete using dataservices when used with ARR.

    In server1 we have ARR which route the calls to server2 where the dataservices is hosted in IIS7.

    Client is connected to the server1 Url.

    If we try to get/add a new entity using the dataservices using the server1 Url it works fine. The calls are getting forwarded to the server2 using UrlRewrite module of ARR.

    But when we try to update/delete an entity, it looks like dataservices layer knows from which server the entity is fetched(ATOM feed contains the server2 Url), so it is posting the message directly to the app server.

    In Silverlight this leads to cross domain issue and the request fails.

    I couldn’t get any help in resolving the issue. Any suggestions for working around this issue?

    Is there any way to overwite the url's in the ATOM feed response from WCF DAtaServices with server1 url?

    Monday, November 21, 2011 12:01 PM

All replies

  • I could able to make use of outbound rules to rewrite the urls returned by wcf data services response before it reaches to the client. I have face one issue in the above workaround. The content lenght of the response is not getting updated properly due to this the object materialization at the client was failing.

    After refering the link http://forums.iis.net/t/1178017.aspx I adjusted the Buffer settings and made it to work. Not able to understand on why the buffer settings is affecting the content-lenght header. Any one have any more details Please let me know.

    Tuesday, November 22, 2011 10:09 AM
  • You can use two techniques, both will require changes to the "proxy" as well as the actual service.

    1) Implement a custom IDataServiceHost and return different values for the AbsoluteServiceUri and AbsoluteRequestUri. Return the values you want the end client to see, not the real server which hosts the service itself. (Note that you need to modify BOTH).

    2) Use the mechanism described here http://blogs.msdn.com/b/peter_qian/archive/2010/03/24/overwriting-the-service-root-uri-in-wcf-data-service.aspx to do pretty much the same with the built-in WCF host.

    One way to use this would be that your "proxy" adds a custom header to the request with the desired base URI of the service and the actual service uses either #1 or #2 to report this new value to the WCF DS.

    Thanks,


    Vitek Karas [MSFT]
    Tuesday, November 22, 2011 10:51 AM
    Moderator