Skip to main content

Microsoft Silverlight

Answered Question Trying to Access a Class Library through a Silverlight 'Live' hosted appRSS Feed

(0)

DJOlson
DJOlson

Member

Member

0 points

6 Posts

Trying to Access a Class Library through a Silverlight 'Live' hosted app

I have a hosted webpage that invokes a SL xap file from the Silverlight 'Live' Streaming site.  This  runs fine, except when I'm trying to open a stream back on the hosted website to access a DLL to read in more content.  I'm using the snippet as follows:

WebClient wc = new WebClient();

wc.OpenReadCompleted += new OpenReadCompletedEventHandler(wc_OpenReadCompleted);

wc.OpenReadAsync(new Uri("SilverlightClassLibrary1", UriKind.Relative));

This fails.  This runs fine if I run the Xap from the hosted website.  I've also tried using a absolute uri to no avail.  Is there a way to have the hosted SL 'Live' xap access the website dll (under clientbin) or am I able to put the dlls on the 'live' site to make it work that way?

 

 

David J. Olson

swildermuth
swildermuth

Star

Star

8320 points

1,546 Posts

Re: Trying to Access a Class Library through a Silverlight 'Live' hosted app

The URI indicates that you are downloading a file called "SilverlightClassLibrary1", shouldn't it be SilverlightClassLibrary1.dll or .xap?

(If this has answered your question, "Mark as Answer")

Shawn Wildermuth
C# MVP, MCSD, Speaker and Author

Silverlight 3 Workshop
Miami, FL: Oct 12-14th
Portlant, OR: Dec 2-4th
Atlanta, GA: Dec 7-9th
http://silverlight-tour.com

DJOlson
DJOlson

Member

Member

0 points

6 Posts

Re: Trying to Access a Class Library through a Silverlight 'Live' hosted app

Yes, it should say 'SilverlightClassLibrary1.dll', my apologies for the typo.

Would it have something to do with a cross domain issue?  It looks like if Im understanding this correctly the .xap file on the SL 'live' site runs in its own domain so  I'm thinking I might need a web service to access the dll now.  With that i'll need a clientaccesspolicy.xml file on the website too I think.  Shawn, does that sound like a direction to follow through on?

David J. Olson

swildermuth
swildermuth

Star

Star

8320 points

1,546 Posts

Answered Question

Re: Re: Trying to Access a Class Library through a Silverlight 'Live' hosted app

Likely not a cross domain problem but a problem with accessing .DLL's from a web server (which is usually expressly forbidden).  You can confirm if the .dll isn't being served by the web service by trying to access the .dll directly (in a browser do http://yourservername.com/SilverlightClassLibrary1.dll) and see if its serving it.  I expect that's the issue, not anything mroe complicated.  So you either need to tell the server to serve .dll's (though I'd limit it to only your SL directory) or renamed it as Silverlight doesn't care what teh .dll is.  Alternatively, .zip it up so you can get the assembly compressed across the wire for more performance.

(If this has answered your question, "Mark as Answer")

Shawn Wildermuth
C# MVP, MCSD, Speaker and Author

Silverlight 3 Workshop
Miami, FL: Oct 12-14th
Portlant, OR: Dec 2-4th
Atlanta, GA: Dec 7-9th
http://silverlight-tour.com
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities