日期:2014-05-18  浏览次数:21101 次

IE打开XAML文件报错
求教:
初学WPF,机器上安装了VS2008和VS2010
帖了段代码到XAML文件里,用IE7打开报错
XAML代码如下:
XAML:
<Button xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Content="OK" />

出错信息:
启动 URI: E:\test.xaml
应用程序标识: file:///C:/WINDOWS/Microsoft.Net/Framework/v3.0/WPF/XamlViewer/XamlViewer_v0300.xbap#XamlViewer_v0300.application, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c3bce3770c238a49, processorArchitecture=msil/XamlViewer_v0300.exe, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c3bce3770c238a49, processorArchitecture=msil, type=win32

System.Security.SecurityException: 请求“System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089”类型的权限已失败。
  在 System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
  在 System.Security.CodeAccessPermission.Demand()
  在 MS.Internal.PresentationFramework.SecurityHelper.DemandUnmanagedCode()
  在 System.Windows.Window..ctor()
  在 System.Windows.Markup.KnownTypes.CreateKnownElement(KnownElements knownElement)
  在 System.Windows.Markup.BamlRecordReader.CreateInstanceFromType(Type type, Int16 typeId, Boolean throwOnFail)
  在 System.Windows.Markup.BamlRecordReader.GetElementAndFlags(BamlElementStartRecord bamlElementStartRecord, Object& element, ReaderFlags& flags, Type& delayCreatedType, Int16& delayCreatedTypeId)
  在 System.Windows.Markup.BamlRecordReader.BaseReadElementStartRecord(BamlElementStartRecord bamlElementRecord)
  在 System.Windows.Markup.BamlRecordReader.ReadElementStartRecord(BamlElementStartRecord bamlElementRecord)
  在 System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)
  在 System.Windows.Markup.XamlTreeBuilder.BamlRecordWriterSyncUpdate(BamlRecord bamlRecord, Int32 lineNumber, Int32 linePosition)
  在 System.Windows.Markup.XamlTreeBuilderBamlRecordWriter.WriteBamlRecord(BamlRecord bamlRecord, Int32 lineNumber, Int32 linePosition)
  在 System.Windows.Markup.BamlRecordWriter.WriteElementStart(XamlElementStartNode xamlElementNode)
  在 System.Windows.Markup.TreeBuilderXamlTranslator.WriteElementStart(XamlElementStartNode xamlElementStartNode)
  在 System.Windows.Markup.XamlParser.ProcessXamlNode(XamlNode xamlNode, Boolean& cleanup, Boolean& done)
  在 System.Windows.Markup.XamlParser.ReadXaml(Boolean singleRecordMode)
  在 System.Windows.Markup.XamlParser.GetParseMode()
  在 System.Windows.Markup.XamlTreeBuilder.ParseFragment()
  在 System.Windows.Markup.TreeBuilder.Parse()
  在 System.Windows.Markup.XamlReader.LoadAsync(Stream stream, ParserContext parserContext)
  在 MS.Internal.AppModel.AppModelKnownContentFactory.XamlConverter(Stream stream, Uri baseUri, Boolean canUseTopLevelBrowser, Boolean sandboxExternalContent, Boolean allowAsync, Boolean isJournalNavigation, XamlReader& asyncObjectConverter)
  在 MS.Internal.AppModel.MimeObjectFactory.GetObjectAndCloseStream(Stream s, ContentType contentType, Uri baseUri, Boolean canUseTopLevelBrowser, Boolean sandboxExternalContent, Boolean allowAsync, Boolean isJournalNavigation, XamlReader& asyncObjectConverter)
  在 System.Windows.Navigation.NavigationService.GetObjectFromResponse(WebRequest request, WebResponse response, Uri destinationUri, Object navState)
  在 System.Windows.Navigation.NavigationService.HandleWebResponse(IAsyncResult ar)
  在 System.Windows.Navigation.NavigationService.<>c__DisplayClassc.<HandleWebResponseOnRightDispatcher>b__8(Object unused)
  在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParamet