problem in Silverlight publish

て烟熏妆下的殇ゞ 提交于 2019-12-24 13:33:22

问题


I have a silverlight 2.0 object on content of masterpage. i see it on local but can't see on the host after publishing. according to Microsoft blog i add 2 MIME type of xaml and xap but silverlight object doesn't appear. i can't see the content of silverlight object but i can configure silverlight by right click. please guide me.


回答1:


If you can right-click and get the Silverlight menu, your object tag is obviously rendering OK, which is a good start.

You don't mention whether you see the "percent loading" blue-dot animation? If that appears then the plugin is loading your XAP file - BUT if you don't see the loading animation it's likely that there is a problem "getting" the XAP file itself. There are two common reasons:

1) The server won't serve XAP files. This is actually quite common as by default IIS won't serve unknown file extensions, and for many hosting providers this includes .XAP. Checking this is very easy: just put the path to your XAP in the browser and try to download it... eg. http://racereplay.net/ClientBin/Silverlight2.xap should pop-up a "Download this file" dialog.

IF you get a 404 Page Not Found then this is why your page isn't working.

The fix in this case is either (i) update the IIS settings (you say you've setup the MIME types already, so just check they are correct) OR (ii) RENAME your .XAP to .ZIP (both the file itself AND in the <object> tag). Most servers have no problem with ZIP files, and Silverlight doesn't mind either.

2) The path to the XAP might be wrong. Double-check that the path is correct, say for this example

<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="../ClientBin/Silverlight2.xap"/>

if the above tag is at http://racereplay.net/SmhHalf/default.aspx... copy the XAP path (source) onto the URL and verify that you get prompted to download the file, eg http://racereplay.net/SmhHalf/../ClientBin/Silverlight2.xap

The fix in this case is simply to get the path right. You mention the <object> tag is on a Masterpage, so you'll probably want an absolute path (eg. "/ClientBin/Your.XAP") because I guess your Masterpage could be used in /default.aspx and also in any subdirectory on your site (/AboutUs/Help.aspx or whatever).

As Anthony said, the software on the server is irrelevant (except for the web server allowing .XAP files to be downloaded), so don't worry about .NET versions there.

If you update your post as you try these suggestions (and perhaps the actual URLs themselves) others may be able to offer more advice.




回答2:


Debug with Fiddler to see what is actually being requested. Are you sure you've published the XAP in the place the HTML expects it to be (typically the ClientBin folder)?

Edit:

Supplementary question is "silverlight 2.0 needs .NET 3.0 or 3.5 on host?"

Which version of .NET is running on the host is not important. Its possible to deliver a silverlight app in plain old HTML.




回答3:


If you are consuming a WCF webservice, make sure you have a clientaccesspolicy.xml file in your iis' root directory. If you are calling the service on start up, it could cause the project to throw an exception and halt execution.




回答4:


I'm using the shared web hosting. After rename the xap file to 'zip' and update the file name in the tag, my first silverlight application is working.

Thanks.




回答5:


yep as u guys said i had prob too but as i changed de file extension to zip it worked..

Seems gotta add xap extension in IIS in MIME

thnx guys.



来源:https://stackoverflow.com/questions/962005/problem-in-silverlight-publish

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!