我如何_properly_通过自托管的WCF服务提供XAP文件? [英] How do I _properly_ serve an XAP file from a self-hosted WCF service?

查看:118
本文介绍了我如何_properly_通过自托管的WCF服务提供XAP文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自我托管的WCF服务器设置,该服务器提供一个clientaccesspolicy.xml和一个index.htm,后者仅指向我的xap(可通过app.xap访问).

I have myself a self-hosted WCF server setup, which 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

它有效,可以完成我要处理的工作.但是,我认为这不能正确地流处理xap,并且我知道这是一种流处理类型.如果无法正确流式传输,我应该如何流式传输?

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?

(XAP和index.htm文件通过的终结点具有webHttpBinding绑定)

(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?

推荐答案

没关系,不需要将XAP文件流传输到客户端.实际上,SL应用程序必须先完全下载(因此在客户端缓冲)才能启动,因此在这种情况下,您不必担心流式传输.

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.

这篇关于我如何_properly_通过自托管的WCF服务提供XAP文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆