无法在Vista / IIS 7环境中打开XPS,可能存在权限问题? [英] Unable to open XPS in Vista / IIS 7 environment, possible permission problem?

查看:70
本文介绍了无法在Vista / IIS 7环境中打开XPS,可能存在权限问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

以下简单的代码片段在Windows 2003 IIS 6和任何具有WinForms的平台上运行但无法运行嵌入在我的开发Vista / IIS工作站上托管的Web服务(WCF)时。我可以确认源文件是否正常,因为我说代码和源文档在同一系统上的WinForms中工作。

使用xpsDoc作为新的System.Windows.Xps.Packaging.XpsDocument(TempFileName,System.IO.FileAccess.Read)
Dim FixedDoc As FixedDocumentSequence

"以下引发异常。
FixedDoc = xpsDoc.GetFixedDocumentSequence()
End Using

这是有些奇怪的错误;​​
{"无法将'System.Windows.Controls.Canvas'类型的内容添加到'System.Windows.Documents.FixedPage'类型的对象中。对象'System.Windows.Controls.Canvas',第5行位置45的错误。}}

这似乎是由于某种有限的权限问题,但我已检查procmon并且文件是打开没有错误(错误不在open语句上,但访问文档序列)。我也尝试过请求FullTrust无效(仍然发生,没有变化)。

这是堆栈跟踪;
在System.Windows.Markup.XamlParseException.ThrowException(String message,Exception innerException,Int32 lineNumber,Int32 linePosition,Uri baseUri,XamlObjectIds currentXamlObjectIds,XamlObjectIds contextXamlObjectIds,Type objectType)
在System.Windows.Markup.XamlParseException.ThrowException(ParserContext parserContext,Int32) lineNumber,Int32 linePosition,String message,Exception innerException)
在System.Windows.Markup.BamlRecordReader.ThrowExceptionWithLine(String message,Exception innerException)
< span style ="color:rgb(0, 0,255); font-family:Courier">在System.Windows.Markup.BamlRecordReader.ThrowException(String id,String parameter1,String parameter2)

at System.Windows.Markup.BamlRecordReader.SetPropertyValueToParent(Boolean fromStartTag,Boolean& isMarkupExtension)
at System .Windows.Markup.BamlRecordReader.BaseReadElementStartRecord(BamlElementStartRecord bamlElementRecord)
在System.Windows.Markup.BamlRecordReader.ReadElementStartRecord(BamlElementStartRecord bamlElementRecord)
在System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)
在System.Windows.Markup.BamlRecordReader.Read(BamlRecord bamlRecord,Int32 lineNumber,Int32 linePosition)
at S ystem.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) < br style ="color:rgb(0,0,255); font-family:Courier"> 在System.Windows.Markup.TreeBuilderXamlTranslator。 WriteElementStart(XamlElementStartNode xamlElementStartNode)
在System.Windows.Markup.XamlParser.ProcessXamlNode(XamlNode xamlNode,布尔和放大器;清理,布尔和&完成)
at System .Windows.Markup.XamlParser.ReadXaml(Boolean singleRecordMode)
在System.Windows.Markup.TreeBuilderXamlTranslator._Parse()
在System.Windows.Markup.XamlParser.Parse()
在System.Windows.Markup.XamlTreeBuilder.ParseFragment()
在System.Windows.Markup.TreeBuilder.Parse() mlReader.XmlTreeBuildDefault(ParserContext pc,Stream stream,XamlParseMode parseMode,Boolean etwTracingEnabled)
在System.Windows.Markup.XamlReader.Load(Stream stream,ParserContext parserContext)
在System.Windows.Documents.XpsValidatingLoader.Load(Stream stream,Uri parentUri,ParserContext pc,ContentType mimeType,String rootElement )
在System。 Windows.Documents.PageContent._LoadPage()
在System.Windows.Documents.PageContent.GetPageRoot(Boolean forceReload)
在System.Windows.Documents.FixedDocument.SyncGetPage(Int32 index,Boolean forceReload)
在System.Windows.Documents.FixedDocument.GetPage(Int32 pageNumber)
在System.Windows.Documents.FixedDocument.OnInitialized(对象发送者,EventArgs e)
在System.Windows.FrameworkContentElement.RaiseInitialized(EventPrivateKey key,EventArgs e)
在System.Windows.FrameworkContentElement.OnInitialized(EventArgs e)
在System.Windows.FrameworkContentElement.TryFireInitialized()
在System.Windows.FrameworkContentElement.EndInit()
(对象&元素)
at System .Windows.Markup.BamlRecordReader.ReadElementEndRecord(Boolean fromNestedBamlRecordReader)
在System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)
在System.Windows.Markup.BamlRecordReader.Read(BamlRecord bamlRecord,Int32 lineNumber,Int32 linePosition)
在System.Windows.Markup.XamlTreeBuilder.BamlRecordWriterSyncUpdate(BamlRecord bamlRecord,Int32 lineNumber) ,Int32 linePosition)
在S ystem.Windows.Markup.XamlTreeBuilderBamlRecordWriter.WriteBamlRecord(BamlRecord bamlRecord,Int32 lineNumber,Int32 linePosition)
在System.Windows.Markup.BamlRecordWriter.WriteAndReleaseRecord(BamlRecord bamlRecord,XamlNode xamlNode)
在System.Windows.Markup.BamlRecordWriter.WriteElementEnd(XamlElementEndNode xamlElementEndNode)
在System.Windows.Markup.XamlParser.WriteElementEnd(XamlElementEndNode) xamlElementEndNode)
at System .Windows.Markup.XamlParser.ProcessXamlNode(XamlNode xamlNode,Boolean&清理,布尔和&完成)
at System .Windows.Markup.XamlParser.ReadXaml(Boolean singleRecordMode)
在System.Windows.Markup.TreeBuilderXamlTranslator._Parse()
在System.Windows.Markup.XamlParser.Parse()
在System.Windows.Markup.XamlTreeBuilder.ParseFragment()
在System.Windows.Markup.TreeBuilder.Parse() mlReader.XmlTreeBuildDefault(ParserContext pc,Stream stream,XamlParseMode parseMode,Boolean etwTracingEnabled)
在System.Windows.Markup.XamlReader.Load(Stream stream,ParserContext parserContext)
在System.Windows.Documents.XpsValidatingLoader.Load(Stream stream,Uri parentUri,ParserContext pc,ContentType mimeType,String rootElement )
在System。 Windows.Documents.DocumentReference._LoadDocument()
在System.Windows.Documents.DocumentReference.GetDocument(Boolean forceReload)
在System.Windows.Documents.FixedDocumentSequence.GetPaginator(DocumentReference docRef)
在System.Windows.Documents.FixedDocumentSequence.get_PageCount()
在System.Windows.Documents.FixedDocumentSequence._OnCollectionChanged( Object sender,NotifyCollectionChangedEventArgs args)
在System.Windows.Documents.DocumentReferenceCollection.OnCollectionChanged(NotifyCollectionChangedAction action,Object item,Int32 index)
在System.Windows.Documents.DocumentReferenceCollection.Add(Do cumentReference item)
at System.Windows.Documents.FixedDocumentSequence._OnDocumentReferenceInitialized(Object sender,EventArgs e)
在System.Windows.FrameworkElement.RaiseInitialized(EventPrivateKey key,EventArgs e)
在System.Windows.FrameworkElement.OnInitialized(EventArgs e)
在System.Windows.FrameworkElement.TryFireInitialized()
在System.Windows.FrameworkElement.EndInit()
在System.Windows.Markup.BamlRecordReader.ElementEndInit(Object&元素)
at System .Windows.Markup.BamlRecordReader.ReadElementEndRecord(Boolean fromNestedBamlRecordReader)
在System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)
在System.Windows.Markup.BamlRecordReader.Read(BamlRecord bamlRecord,Int32 lineNumber,Int32 linePosition)
在System.Windows.Markup.XamlTreeBuilder.BamlRecordWriterSyncUpdate(BamlRecord bamlRecord,Int32 lineNumber) ,Int32 linePosition)
在S ystem.Windows.Markup.XamlTreeBuilderBamlRecordWriter.WriteBamlRecord(BamlRecord bamlRecord,Int32 lineNumber,Int32 linePosition)
在System.Windows.Markup.BamlRecordWriter.WriteAndReleaseRecord(BamlRecord bamlRecord,XamlNode xamlNode)
在System.Windows.Markup.BamlRecordWriter.WriteElementEnd(XamlElementEndNode xamlElementEndNode)
在System.Windows.Markup.XamlParser.WriteElementEnd(XamlElementEndNode) xamlElementEndNode)
at System .Windows.Markup.XamlParser.ProcessXamlNode(XamlNode xamlNode,Boolean&清理,布尔和&完成)
at System .Windows.Markup.XamlParser.ReadXaml(Boolean singleRecordMode)
在System.Windows.Markup.TreeBuilderXamlTranslator._Parse()
在System.Windows.Markup.XamlParser.Parse()
在System.Windows.Markup.XamlTreeBuilder.ParseFragment()
在System.Windows.Markup.TreeBuilder.Parse() mlReader.XmlTreeBuildDefault(ParserContext pc,Stream stream,XamlParseMode parseMode,Boolean etwTracingEnabled)
在System.Windows.Markup.XamlReader.Load(Stream stream,ParserContext parserContext)
在System.Windows.Xps.Packaging.XpsDocument.GetFixedDocumentSequence()

任何帮助将非常感谢;

问候

Ryan

解决方案

请参阅以下更新:
https:// connect。 microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=361469

http://www.microsoft.com/downloads/details.aspx?familyid=b9de7937-2c12-4f16-ad66-a31b83931953&displaylang=en

Hi all,

The following simple code snippet works when run on Windows 2003 IIS 6 and any platform with WinForms but fails when embedded in a web service (WCF) that is hosted on my development Vista / IIS workstation. I can confirm the source documents are fine, as I say the code and source docs work in WinForms on the same system.

    Using xpsDoc As New System.Windows.Xps.Packaging.XpsDocument(TempFileName, System.IO.FileAccess.Read)
        Dim FixedDoc As FixedDocumentSequence

        ' The following throws an exception.
        FixedDoc = xpsDoc.GetFixedDocumentSequence()
    End Using

This is the somewhat odd error;
{"Cannot add content of type 'System.Windows.Controls.Canvas' to an object of type 'System.Windows.Documents.FixedPage'.  Error at object 'System.Windows.Controls.Canvas', Line 5 Position 45."}

It seems to be due to some kind of limited permission issue but I've checked with procmon and the file is opened fine with no errors (the error is not on the open statement either, but the access to the document sequence). I've also tried requesting FullTrust to no avail (still happens, no change).

This is the stack trace;
   at System.Windows.Markup.XamlParseException.ThrowException(String message, Exception innerException, Int32 lineNumber, Int32 linePosition, Uri baseUri, XamlObjectIds currentXamlObjectIds, XamlObjectIds contextXamlObjectIds, Type objectType)
   at System.Windows.Markup.XamlParseException.ThrowException(ParserContext parserContext, Int32 lineNumber, Int32 linePosition, String message, Exception innerException)
   at System.Windows.Markup.BamlRecordReader.ThrowExceptionWithLine(String message, Exception innerException)
   at System.Windows.Markup.BamlRecordReader.ThrowException(String id, String parameter1, String parameter2)
   at System.Windows.Markup.BamlRecordReader.SetPropertyValueToParent(Boolean fromStartTag, Boolean& isMarkupExtension)
   at System.Windows.Markup.BamlRecordReader.BaseReadElementStartRecord(BamlElementStartRecord bamlElementRecord)
   at System.Windows.Markup.BamlRecordReader.ReadElementStartRecord(BamlElementStartRecord bamlElementRecord)
   at System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)
   at System.Windows.Markup.BamlRecordReader.Read(BamlRecord bamlRecord, Int32 lineNumber, Int32 linePosition)
   at System.Windows.Markup.XamlTreeBuilder.BamlRecordWriterSyncUpdate(BamlRecord bamlRecord, Int32 lineNumber, Int32 linePosition)
   at System.Windows.Markup.XamlTreeBuilderBamlRecordWriter.WriteBamlRecord(BamlRecord bamlRecord, Int32 lineNumber, Int32 linePosition)
   at System.Windows.Markup.BamlRecordWriter.WriteElementStart(XamlElementStartNode xamlElementNode)
   at System.Windows.Markup.TreeBuilderXamlTranslator.WriteElementStart(XamlElementStartNode xamlElementStartNode)
   at System.Windows.Markup.XamlParser.ProcessXamlNode(XamlNode xamlNode, Boolean& cleanup, Boolean& done)
   at System.Windows.Markup.XamlParser.ReadXaml(Boolean singleRecordMode)
   at System.Windows.Markup.TreeBuilderXamlTranslator._Parse()
   at System.Windows.Markup.XamlParser.Parse()
   at System.Windows.Markup.XamlTreeBuilder.ParseFragment()
   at System.Windows.Markup.TreeBuilder.Parse()
   at System.Windows.Markup.XamlReader.XmlTreeBuildDefault(ParserContext pc, Stream stream, XamlParseMode parseMode, Boolean etwTracingEnabled)
   at System.Windows.Markup.XamlReader.Load(Stream stream, ParserContext parserContext)
   at System.Windows.Documents.XpsValidatingLoader.Load(Stream stream, Uri parentUri, ParserContext pc, ContentType mimeType, String rootElement)
   at System.Windows.Documents.PageContent._LoadPage()
   at System.Windows.Documents.PageContent.GetPageRoot(Boolean forceReload)
   at System.Windows.Documents.FixedDocument.SyncGetPage(Int32 index, Boolean forceReload)
   at System.Windows.Documents.FixedDocument.GetPage(Int32 pageNumber)
   at System.Windows.Documents.FixedDocument.OnInitialized(Object sender, EventArgs e)
   at System.Windows.FrameworkContentElement.RaiseInitialized(EventPrivateKey key, EventArgs e)
   at System.Windows.FrameworkContentElement.OnInitialized(EventArgs e)
   at System.Windows.FrameworkContentElement.TryFireInitialized()
   at System.Windows.FrameworkContentElement.EndInit()
   at System.Windows.Markup.BamlRecordReader.ElementEndInit(Object& element)
   at System.Windows.Markup.BamlRecordReader.ReadElementEndRecord(Boolean fromNestedBamlRecordReader)
   at System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)
   at System.Windows.Markup.BamlRecordReader.Read(BamlRecord bamlRecord, Int32 lineNumber, Int32 linePosition)
   at System.Windows.Markup.XamlTreeBuilder.BamlRecordWriterSyncUpdate(BamlRecord bamlRecord, Int32 lineNumber, Int32 linePosition)
   at System.Windows.Markup.XamlTreeBuilderBamlRecordWriter.WriteBamlRecord(BamlRecord bamlRecord, Int32 lineNumber, Int32 linePosition)
   at System.Windows.Markup.BamlRecordWriter.WriteAndReleaseRecord(BamlRecord bamlRecord, XamlNode xamlNode)
   at System.Windows.Markup.BamlRecordWriter.WriteElementEnd(XamlElementEndNode xamlElementEndNode)
   at System.Windows.Markup.XamlParser.WriteElementEnd(XamlElementEndNode xamlElementEndNode)
   at System.Windows.Markup.XamlParser.ProcessXamlNode(XamlNode xamlNode, Boolean& cleanup, Boolean& done)
   at System.Windows.Markup.XamlParser.ReadXaml(Boolean singleRecordMode)
   at System.Windows.Markup.TreeBuilderXamlTranslator._Parse()
   at System.Windows.Markup.XamlParser.Parse()
   at System.Windows.Markup.XamlTreeBuilder.ParseFragment()
   at System.Windows.Markup.TreeBuilder.Parse()
   at System.Windows.Markup.XamlReader.XmlTreeBuildDefault(ParserContext pc, Stream stream, XamlParseMode parseMode, Boolean etwTracingEnabled)
   at System.Windows.Markup.XamlReader.Load(Stream stream, ParserContext parserContext)
   at System.Windows.Documents.XpsValidatingLoader.Load(Stream stream, Uri parentUri, ParserContext pc, ContentType mimeType, String rootElement)
   at System.Windows.Documents.DocumentReference._LoadDocument()
   at System.Windows.Documents.DocumentReference.GetDocument(Boolean forceReload)
   at System.Windows.Documents.FixedDocumentSequence.GetPaginator(DocumentReference docRef)
   at System.Windows.Documents.FixedDocumentSequence.get_PageCount()
   at System.Windows.Documents.FixedDocumentSequence._OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
   at System.Windows.Documents.DocumentReferenceCollection.OnCollectionChanged(NotifyCollectionChangedAction action, Object item, Int32 index)
   at System.Windows.Documents.DocumentReferenceCollection.Add(DocumentReference item)
   at System.Windows.Documents.FixedDocumentSequence._OnDocumentReferenceInitialized(Object sender, EventArgs e)
   at System.Windows.FrameworkElement.RaiseInitialized(EventPrivateKey key, EventArgs e)
   at System.Windows.FrameworkElement.OnInitialized(EventArgs e)
   at System.Windows.FrameworkElement.TryFireInitialized()
   at System.Windows.FrameworkElement.EndInit()
   at System.Windows.Markup.BamlRecordReader.ElementEndInit(Object& element)
   at System.Windows.Markup.BamlRecordReader.ReadElementEndRecord(Boolean fromNestedBamlRecordReader)
   at System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)
   at System.Windows.Markup.BamlRecordReader.Read(BamlRecord bamlRecord, Int32 lineNumber, Int32 linePosition)
   at System.Windows.Markup.XamlTreeBuilder.BamlRecordWriterSyncUpdate(BamlRecord bamlRecord, Int32 lineNumber, Int32 linePosition)
   at System.Windows.Markup.XamlTreeBuilderBamlRecordWriter.WriteBamlRecord(BamlRecord bamlRecord, Int32 lineNumber, Int32 linePosition)
   at System.Windows.Markup.BamlRecordWriter.WriteAndReleaseRecord(BamlRecord bamlRecord, XamlNode xamlNode)
   at System.Windows.Markup.BamlRecordWriter.WriteElementEnd(XamlElementEndNode xamlElementEndNode)
   at System.Windows.Markup.XamlParser.WriteElementEnd(XamlElementEndNode xamlElementEndNode)
   at System.Windows.Markup.XamlParser.ProcessXamlNode(XamlNode xamlNode, Boolean& cleanup, Boolean& done)
   at System.Windows.Markup.XamlParser.ReadXaml(Boolean singleRecordMode)
   at System.Windows.Markup.TreeBuilderXamlTranslator._Parse()
   at System.Windows.Markup.XamlParser.Parse()
   at System.Windows.Markup.XamlTreeBuilder.ParseFragment()
   at System.Windows.Markup.TreeBuilder.Parse()
   at System.Windows.Markup.XamlReader.XmlTreeBuildDefault(ParserContext pc, Stream stream, XamlParseMode parseMode, Boolean etwTracingEnabled)
   at System.Windows.Markup.XamlReader.Load(Stream stream, ParserContext parserContext)
   at System.Windows.Xps.Packaging.XpsDocument.GetFixedDocumentSequence()

Any help would be much appreciated;

Regards

Ryan

解决方案

refer to the following update:
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=361469

http://www.microsoft.com/downloads/details.aspx?familyid=b9de7937-2c12-4f16-ad66-a31b83931953&displaylang=en


这篇关于无法在Vista / IIS 7环境中打开XPS,可能存在权限问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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