Skip to main content
Home Forums Silverlight Programming Silverlight Controls and Silverlight Toolkit Image doesn't show after deployment
3 replies. Latest Post by Ultravi0let on September 30, 2008.
(0)
Ultravi0let
Member
45 points
48 Posts
09-30-2008 8:16 AM |
Hello,
I have a xaml page with an Image control, to which I set the source this way:
MyImage.Source = new BitmapImage(new Uri("http://localhost:2519/clientbin/images/book217088/page1.jpg"));
I am adding images to the application dynamically so I couldn't make them show on any other way.
I fixed the application's port to 2519, since I'm using a WCF service, so the call to the image worked fine while I was developping.
I deployed the application locally on IIS, gave it port 89. I changed the instruction:
MyImage.Source = new BitmapImage(new Uri("http://localhost:89/clientbin/images/book217088/page1.jpg"));
so the image can show, and it shows locally.
I deployed the application on our server, using the same port and doing the same thing that I did while deploying on my machine, the images doesn't show.
What do I need to do to make it show ?
Regards,
Sanaa
HarshBar...
Star
9908 points
1,719 Posts
09-30-2008 8:27 AM |
Hi,
Are you able to Paste that Image Path in Browser and able to acess that Image.
Instead of Hard coding that Try Building Path Like this.
String UriPath = Application.Current.Host.Source.AbsoluteUri.Substring(0, Application.Current.Host.Source.AbsoluteUri.LastIndexOf("/ClientBin"));
MyImage.Source = new BitmapImage(new Uri(UriPath+"/clientbin/images/book217088/page1.jpg"));
09-30-2008 8:58 AM |
when I call : http://srv-dev:89/MyBookWeb/ClientBin/images/book217088/page1.jpg I can see the image in the browser.
I put the code you recommanded, it looks better but the image still doesn't show.
I have the 4001 error, as far as I know this has not been fixed yet on SL, I had this error before on the same page but it never stoped me from viewing my images.
09-30-2008 9:20 AM |
I tried again, it works now :)
Thank you so much.
Sanaa RAMZI