Skip to main content

Microsoft Silverlight

Answered Question Image doesn't show after deploymentRSS Feed

(0)

Ultravi0let
Ultravi0let

Member

Member

45 points

48 Posts

Image doesn't show after deployment

 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

 

HarshBardhan
HarshBar...

Star

Star

9908 points

1,719 Posts

Answered Question

Re: Image doesn't show after deployment

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"));

Mark as answer if this post answered your question.

Harsh Bardhan

Ultravi0let
Ultravi0let

Member

Member

45 points

48 Posts

Re: Image doesn't show after deployment

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.

Ultravi0let
Ultravi0let

Member

Member

45 points

48 Posts

Re: Image doesn't show after deployment

 I tried again, it works now :)

Thank you so much.

Regards,

Sanaa RAMZI

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities