开发者

How do I _properly_ serve an XAP file from a self-hosted WCF service?

I have myself a self-hosted WCF server setup, whic开发者_如何学Ch serves a clientaccesspolicy.xml and an index.htm which is just points to my xap (accessible via app.xap).

I'm currently serving them via the following code:

Public Function GetPolicy() As System.IO.Stream Implements IClientAccessPolicy.GetPolicy

    WebOperationContext.Current.OutgoingResponse.ContentType = "application/xml"
    Return New IO.MemoryStream(IO.File.ReadAllBytes("Server Files/ClientAccessPolicy.xml"))

End Function

Public Function GetIndex() As IO.Stream Implements ISilverlightServer.GetIndex

    WebOperationContext.Current.OutgoingResponse.ContentType = "text/html"
    Return New IO.MemoryStream(IO.File.ReadAllBytes("Server Files/index.htm"))

End Function

Public Function GetXap() As IO.Stream Implements ISilverlightServer.GetXap

    WebOperationContext.Current.OutgoingResponse.ContentType = "application/x-silverlight-app"
    Return New IO.MemoryStream(IO.File.ReadAllBytes("Server Files/app.xap"))

End Function

It works, does the job I'm after. However, I don't think this streams the xap properly, and I know it's a streaming type. If this isn't streaming it properly, how should I stream it?

(The endpoint that the XAP and index.htm files are coming through has a webHttpBinding binding)

Is it being streamed properly? Or should I make some changes?


That is fine, the XAP file doesn't need to be streamed to the client. Actually, it needs to be first fully downloaded (thus buffered at the client) for the SL application to start, so you don't need to worry about streaming in this case.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜