Silverlight导航在IIS中失败 [英] Silverlight Navigation failed in IIS

查看:64
本文介绍了Silverlight导航在IIS中失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我做了一个相当简单的Silverlight应用程序.它涉及一些导航.

我在VS2010中使用了模板,下面是我所做的更改.

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.

<pre lang="xml"><navigation:Frame x:Name="ContentFrame" Style="{StaticResource ContentFrameStyle}" Source="/Home" Navigated="ContentFrame_Navigated" NavigationFailed="ContentFrame_NavigationFailed"><br />
               <navigation:Frame.UriMapper><br />
                 <uriMapper:UriMapper><br />
                   <uriMapper:UriMapping Uri="" MappedUri="/Views/Home.xaml"/><br />
                       <uriMapper:UriMapping Uri="/A" MappedUri="/Views/About.xaml"/><br />
                       <uriMapper:UriMapping Uri="/{pageName}" MappedUri="/Views/{pageName}.xaml"/><br />
                   <uriMapper:UriMapping Uri="/Document1" MappedUri="/Views/Documents/Document1.xaml"/><br />
                   </uriMapper:UriMapper><br />
               </navigation:Frame.UriMapper><br />
           </navigation:Frame></pre><br />



很简单吧?在de silverligt应用程序中,我有一个Views文件夹,在该文件夹中有一个名为Documents的文件夹.

当我在Visual Studio 2010中按F5键时,一切正常!当我在URL中添加"A"时,我转到About.xaml.当我在URL中添加"Document1"时,我还会看到正确的页面.

但...!当我将Web应用程序添加到IIS7时,导航不再起作用.您可能知道模板带有主页"和关于"按钮.这两个工作正常.
只是说:找不到页面:/Documents/Document1

MIME类型在IIS中是正确的.

我为什么要面对这个问题?

希望有人能帮助我.

谢谢!



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!

推荐答案

我首先使用本地IIS进行测试.这是我迈向生活的第一步.我的工作:

1.我制作了de silverlight应用程序(duh!)
2.我将一个新网站添加到IIS,并将其指向silverlight应用程序的文件夹.

这应该工作,对不对?还是我说的是真的很愚蠢? ;)
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? ;)


在这种情况下,主机只是交付Silverlight应用程序,因此它在托管的位置应该没有区别

首先,我不认为"A"链接可以在任何主机中工作,因为它将查找A.XAML,而不是About.xaml.
放这行
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" />



我在两台主机上都对其进行了测试-所有链接都可以正常工作,因此,如果仍然无法为您工作,则您添加的页面的XAML不在正确的位置,则您添加的页面的类型也不为"System.Windows.Controls.Page",或者您输入的URL错误.



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.


这篇关于Silverlight导航在IIS中失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆