Architecture dilemma: serving images in a 3-tier (mvc3 webapp -> webservice -> couchdb) setup

StackOverflow https://stackoverflow.com/questions/9380822

  •  28-10-2019
  •  | 
  •  

문제

I have a project with a 3-tier architecture. User front-ends (one of them is a regular ASP.NET MVC3 web app) communicate with a common ASP.NET web service which acts as an intermediary to a CouchDB data store.

Until now, I've only been transferring textual data which didn't require any special handling and has worked well. But now, for the first time, I also have to serve images along with text. The images are stored as attachments to CouchDB documents and can be accessed by REST-ful URLs.

The problem is, those REST-ful URLs are only valid from the middle tier (the web service). How do I best expose them to client tiers that have no direct access to the CouchDB back-end (and should stay that way)?

I've thought about implementing some sort of URL rewriting/forwarding scheme, but I'm not quite sure how to do that or even if it's the appropriate solution.

All ideas are welcome!

도움이 되었습니까?

해결책

It seems people don't enjoy open questions like this one... :)

For what is worth, I decided to upgrade my web service to support MVC3-style REST routing. All requests that come to /Images/{document}/{id} are mapped to their equivalent CouchDB URLs.

Later on, I'll maybe throw in a caching layer to relieve the web service and the data store from serving the same images again and again.

I'm still open to better ideas, of course. :)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top