I am building a simple HTTP file server.
I have an asp.net web application that exposes a WCF service (FileService.svc).
The service contract is:
[OperationContract]
[WebGet(UriTemplate = "/*")]
Stream HandleFileRequest();
The service implementation is quite straightforward and basically I use :
WebOperationContext.Current.IncomingRequest.UriTemplateMatch.RequestUri
To get the path of the file to return (A little parsing is required to extract it).
So for instance, when hosting the app locally on IIS , I can request a file from : http://localhost:65000/FileService.svc/someFolder1/someFolder2/someFile1.jpg
The problems starts when this request is made from inside a silverlight app. Silverlight searches the clientaccesspolicy file in http://localhost:65000/clientaccesspolicy.xml
The problem is that now, this request won't reach the service because FileService.svc is ommited from the url.
(I want all the file requests to be handled by the WCF service in HandleFileRequest(), and not any other mechanism.)
One solution I can think of is to use the URL Rewrite module of IIS 7.
Is this the right way to do this, or there simpler solution to this ?