我在两个页面中使用自定义的Silverlight项目,可是得到的效果完全不一样
1、在项目目录下:FinalApplication\TestForSL.aspx
1 <div id="silverlightControlHost">
2 <object data="data:application/x-silverlight-2," type="application/x-silverlight-2"
3 width="100%" height="100%">
4 <param name="InitParams" value="PersonID=<%=PersonID %>,DCID=<%=DCID %>" />
5 <param name="source" value="ClientBin/DContainerTime.xap" />
6 <param name="onerror" value="onSilverlightError" />
7 <param name="background" value="white" />
8 <param name="minRuntimeVersion" value="3.0.40818.0" />
9 <param name="autoUpgrade" value="true" />
10 <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40818.0" style="text-decoration: none;">
11 <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="获取 Microsoft Silverlight"
12 style="border-style: none" />
13 </a>
14 </object>
15 <iframe id="_sl_historyFrame" style='visibility: hidden; height: 0; width: 0; border: 0px'>
16 </iframe>
17 </div>
可以正常的调用Silverlight。
2、在次级目录下:FinalApplication\Teacher\CourseSelectionTask\DCTime.aspx
1 <div style="width:100%; height:100%">
2 <object data="data:application/x-silverlight-2," type="application/x-silverlight-2"
3 width="100%" height="100%">
4 <param name="InitParams" value="PersonID=<%=PersonID %>,DCID=<%=DCID %>" />
5 <param name="source" value="../ClientBin/DContainerTime.xap" />
6 <param name="onerror" value="onSilverlightError" />
7 <param name="background" value="white" />
8 <param name="minRuntimeVersion" value="3.0.40818.0" />
9 <param name="autoUpgrade" value="true" />
10 <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40818.0" style="text-decoration: none;">
11 <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="获取 Microsoft Silverlight"
12 style="border-style: none" />
13 </a>
14 </object>
15 <iframe id="_sl_historyFrame" style='visibility: hidden; height: 0; width: 0; border: 0px'>
16 </iframe>
17 </div>
网页错误详细信息
用户代理: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729;
.NET4.0C; .NET4.0E)时间戳: Wed, 1 Jun 2011 03:22:26 UTC
消息: Silverlight 应用程序中未处理的错误 代码: 2104 类别: InitializeError 消息: 无法下载 Silverlight 应用程序。请查看 Web 服务器设置
行: 202字符: 13代码: 0URI: http://localhost:9001/Teacher/CourseSelectionTask/DCTime.aspx
<param name="source" value="../ClientBin/DContainerTime.xap"/>
这个路径的问题 把..去掉试试吧