Click here to Skip to main content
16,021,823 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi,

I have made a rather simple silverlight application. It involves some navigation.

I have used the template in VS2010 and below is what I have changed.
XML
<navigation:Frame x:Name="ContentFrame" Style="{StaticResource ContentFrameStyle}" Source="/Home" Navigated="ContentFrame_Navigated" NavigationFailed="ContentFrame_NavigationFailed">
               <navigation:Frame.UriMapper>
                 <uriMapper:UriMapper>
                   <uriMapper:UriMapping Uri="" MappedUri="/Views/Home.xaml"/>
                       <uriMapper:UriMapping Uri="/A" MappedUri="/Views/About.xaml"/>
                       <uriMapper:UriMapping Uri="/{pageName}" MappedUri="/Views/{pageName}.xaml"/>
                   <uriMapper:UriMapping Uri="/Document1" MappedUri="/Views/Documents/Document1.xaml"/>
                   </uriMapper:UriMapper>
               </navigation:Frame.UriMapper>
           </navigation:Frame>


Quite simple right? In de silverligt application I have a folder Views and within that folder I have a folder called Documents.

When I hit F5 in visual studio 2010 it all works fine! When I add "A" in the URL I go to the About.xaml. When I add "Document1" in the URL I also see the proper page.

But...! When I add the webapplication to IIS7 the navigation does not work anymore. As you might know the template comes with a Home and About button. These two work fine.
It just simply says: Page not found: /Documents/Document1

MIME-types are correct in IIS.

Why do I face this problem?

Hope someone can help me.

Thanks!
Posted
Updated 15-May-11 22:18pm
v2
Comments
Mark Salsbery 16-May-11 14:16pm    
Are you sure you have deployed the application to IIS correctly and completely?

You know you can set your host application to run right in local IIS server instead of the Visual Studio Development Server, right?

I use the local IIS for testing first. This is my first step towards live. What I do:

1. I make de silverlight app (duh!)
2. I add a new website to IIS and point it to the folder of the silverlight app.

This should work, right? Or am I saying something really stupid? ;)
 
Share this answer
 
Comments
Mark Salsbery 22-May-11 10:03am    
You know, Visual Studio will do your step 2 for you, right from the hosting app's properties :)
But I agree...if you're going to host on IIS you may as well test on IIS as well!
Ken Elz 23-May-11 19:07pm    
Yes, Iknow, but!... I need to add the website (like www.thewebsite.com) to IIS, not on the localhost. I need to set the binding straight.
Anyway, not really an anwser. I would like to know WHY I cannot navigate while the website is bound to IIS while it works fine in VS2010 (i.e. http://localhost:1234).
Mark Salsbery 23-May-11 21:19pm    
I'm just saying if you're going to deploy in IIS then why not test there? Regardless it should work the same - it's the Silverlight app doing the navigation, not the host.
The host just delivers the Silverlight app in this case, so it should make no difference where it's hosted

First, I don't believe the "A" link would work in any host because it will look for A.XAML, not About.xaml.
Put this line
<urimapper:urimapping uri="/A" mappeduri="/Views/About.xaml" xmlns:urimapper="#unknown" />

above this line
<urimapper:urimapping uri="/{pageName}" mappeduri="/Views/{pageName}.xaml" xmlns:urimapper="#unknown" />


I tested it on both hosts - all links work fine, so if it's still not working for you then either the XAML for the pages you added aren't in the right place, the pages you added are not of type "System.Windows.Controls.Page", or you're typing the URL wrong.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900