Skip to main content

Microsoft Silverlight

Answered Question Getting started...RSS Feed

(0)

ddni_nk
ddni_nk

Member

Member

6 points

53 Posts

Getting started...

I have just been given a project as an intern to integrate silverlight controls into an existing company html webpage...

I've opened the files in VS2008 and tried adding a new SL control to the project but it doesn't give me an option to do so.

When I tried creating my own ASP.net Web Application and then adding a SL control it works great. I am able to open the html page and the SL control shows up fine.

 Any ideas?

Any assistance regarding this matter will be greatly appreciated.

SharpGIS
SharpGIS

Contributor

Contributor

3397 points

611 Posts

Re: Getting started...

 You cannot add Silverlight control to a website. You should instead add a new silverlight project to the visual studio solution, then right-click the website project, edit its settings, go to silverlight and add your silverlight application.

What this does is everytime you build the .xap will be copied to your website. When you do the above steps, it will generate two test pages, which you can delete, but wait a bit. First open the .html testpage, then copy the <object> tag and the <script> tag and copy to the page where you want to add a silverlight element.

--
/Morten | blog - twitter
Please click on "Mark as Answer" if this answered your question.

paru
paru

Member

Member

164 points

28 Posts

Re: Getting started...

Copy past the HTML on the page that loads the silverlight content into the page where you require it

Again add the silverlight.js also

Thanks
Paru

--mark as answer if helped

ddni_nk
ddni_nk

Member

Member

6 points

53 Posts

Re: Getting started...

 Thanks for the reply... I tried what you said, by adding a new silverlight project to my vs solution, then copying the <object> and <script> tags into my index.html page where I want to display the silverlight, however this did not work.

 When I view the html page in a browser, the silverlight object doesn't appear. It seems to keep trying to load but nothing shows up, the rest of the html portion however does display. 

 Any ideas on why its not working? One thing I wasn't quite sure about from your last post was when you said to "edit its settings"... I didn't know what you meant by that, maybe you can clarify for me.

 

Thanks again.

davidezordan
davidezo...

Contributor

Contributor

5614 points

863 Posts

Silverlight MVP

ddni_nk
ddni_nk

Member

Member

6 points

53 Posts

Re: Getting started...


SharpGIS
SharpGIS

Contributor

Contributor

3397 points

611 Posts

Re: Re: Getting started...

 Have you configured IIS to set the correct content type for .xap files ?

--
/Morten | blog - twitter
Please click on "Mark as Answer" if this answered your question.

ddni_nk
ddni_nk

Member

Member

6 points

53 Posts

Re: Re: Getting started...

 No I have not...that could very well be the issue. I'm trying to figure out how to do that right now.

ddni_nk
ddni_nk

Member

Member

6 points

53 Posts

Re: Re: Getting started...

 

SharpGIS:

 Have you configured IIS to set the correct content type for .xap files ?

 

Could you point me in the direction of how I can go about doing this?

 I already looked in IIS and found that the following types were already present:

  • .xap     application/x-silverlight-app
  • .xaml    application/xaml+xml
  • .xbap    application/x-ms-xbap

 But is there any thing else I need to do, because it still doesn't work.

Thanks again!

SharpGIS
SharpGIS

Contributor

Contributor

3397 points

611 Posts

Re: Re: Re: Getting started...

Run Fiddler (www.fiddlertool.com) and verify that the .xap and .js is requested as expected when you load the page (ensure the requests are there and they are not red)

Your mime mappings looks fine.

--
/Morten | blog - twitter
Please click on "Mark as Answer" if this answered your question.

ddni_nk
ddni_nk

Member

Member

6 points

53 Posts

Re: Re: Re: Getting started...

I've been testing my project all along in Firefox, but when you told me to use Fiddler I ran it in IE8. In IE I can actually see the spot where the SL control is supposed to be and it does indeed try to load it (this did not happen in Firefox)... So there definitely is some progress here, but it still doesn't load.

I did however receive an error message while running in IE that I didn't get in Firefox:

 Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; InfoPath.2; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618)
Timestamp: Tue, 30 Jun 2009 16:52:33 UTC


Message: Unhandled Error in Silverlight 2 Application
Code: 2104   
Category: InitializeError      
Message: Could not download the Silverlight application. Check web server settings    

Line: 70
Char: 13
Code: 0

Again, I've checked MIME types and the three needed are added in there correctly.


How can I fix this? Any ideas? 

 

 

ddni_nk
ddni_nk

Member

Member

6 points

53 Posts

Re: Re: Re: Getting started...

  BTW, running fiddler didnt show any requests for .js or .xap.

Here's the report from fiddler:

.REQUEST { font: 8pt Courier New; color: blue;} .RESPONSE { font: 8pt Courier New; color: green;}

#ResultProtocolHostURLBodyCachingContent-TypeProcessCommentsCustom
0200HTTPwww.fiddler2.com/fiddler2/updatecheck.asp?isBeta=False411private text/plainfiddler:3216
1302HTTPgo.microsoft.com/fwlink/?LinkId=108181242private Expires: Tue, 30 Jun 2009 17:16:53 GMTtext/html; charset=utf-8iexplore:3288
2304HTTPsilverlight.dlservice.microsoft.com/download/d/2/9/d29e5571-4b68-4d95-b43a-4e81ba178455/2.0/ENU/InstallSilverlight.png0image/pngiexplore:3288
3200HTTPloc1.hitsprocessor.com/statistics.asp?v=1&s=3&acct=v4700_69906a10&an=Microsoft%20Internet%20Explorer&sr=&ck=14&rf=&sl=en-us&av=4.0%20%28compatible%3B%20MSIE%208.0%3B%20Windows%20NT%206.0%3B%20WOW64%3B%20Trident/4.0%3B%20SLCC1%3B%20.NET%20CLR%202.0.50727%3B%20Media%20Center%20PC%205.0%3B%20InfoPath.2%3B%20.NET%20CLR%203.5.21022%3B%20.NET%20CLR%203.5.30729%3B%20.NET%20CLR%203.0.30618%29&l=undefined&pf=Win32&pg=/C%3A/Users/nkumar/Desktop/Corp%2520Web%2520Files/ver_0/corpwebfiles_ver0/index.html&cd=32&rs=1600%20x%201200&tz=420&je=true&tks=124638228176648no-cache, no-store, must-revalidate, no-transform Expires: -1image/gifiexplore:3288
4 - HTTPloc1.hitsprocessor.com/track.js-1iexplore:3288
 

SharpGIS
SharpGIS

Contributor

Contributor

3397 points

611 Posts

Re: Re: Re: Re: Getting started...

Note that fiddler doesnt by default track requests to localhosts. Try and replace localhost with the machine name. You should see requests for your html page as well.

The error you are getting indicates that it cannot find the .xap fle. My guess is that you dont have it in /ClientBin/SilverlightApplication1.xap

--
/Morten | blog - twitter
Please click on "Mark as Answer" if this answered your question.

ddni_nk
ddni_nk

Member

Member

6 points

53 Posts

Re: Re: Re: Re: Getting started...

 I'm fairly sure that my .xap is in the client bin. Here is what my solution explorer looks like in VS2008, maybe someone can double check if its in the correct location:

http://tinypic.com/r/35iof10/5

 

Also, regarding changing localhost to machine name, I'm assuming you mean for me to change it in the url when I launch the website? 

The original url when I launch the site is this: C:\Users\nk\Desktop\Corp Web Files\ver_0\corpwebfiles_ver0\index.html

Do I change this to: http://dev33/Corp%20Web%20Files/ver_0/corpwebfiles_ver0/index.html

(where dev33 is my machine name)... if so, this didn't work and I received a 404 Not Found page:

 

 

Module IIS Web Core
Notification MapRequestHandler
Handler StaticFile
Error Code 0x80070002
Requested URL http://dev33:80/Corp Web Files/ver_0/corpwebfiles_ver0/index.html
Physical Path C:\inetpub\wwwroot\Corp Web Files\ver_0\corpwebfiles_ver0\index.html
Logon Method Anonymous
Logon User Anonymous

 

Thanks for the help, really appreciate it.

 

SharpGIS
SharpGIS

Contributor

Contributor

3397 points

611 Posts

Answered Question

Re: Re: Re: Re: Re: Getting started...

Remove SilverlightApplication1.Web. This project is for testing your silverlight app, but you want your silverlight app to run in the existing website (meaning you don't need that autogenerated  web app).

You need the .xap placed in the other website, and you need to reference the .xap in the source property using a correct relative path where it can find that.

--
/Morten | blog - twitter
Please click on "Mark as Answer" if this answered your question.
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities