2011-07-13 30 views
4

私は大きなWebアプリケーションを持っています。このWebアプリケーションの非常に小さな部分は、OpenXMLライブラリ(C#で書かれています)を使ってXLSXファイルを生成します。OpenXML、IsolatedStorage、NETWORK SERVICEおよびWindows Server 2008

私はこの記事で説明する問題に遭遇しました:IsolatedStorage Access Denied

はしかし、説明書には、Windows Server 2003のために存在し、そして2008年には、ユーザーのディレクトリ階層が異なっています。

私はこれらの場所にIsolatedStorageのディレクトリを作成してみました(と、それへのネットワークサービスのアクセス権を与える)しました:

C:\ Users \ユーザーデフォルト\のAppData \ローカル\ IsolatedStorage C:\ Users \ユーザーデフォルトを\ AppData \ Roaming \ IsolatedStorage

これらは機能しませんでした。私は、IsolatedStorageディレクトリの適切な場所が、Windows Server 2008(通常はGoogleを使用し、ここでは特に)を使用して成功した場所を見つけようとしました。

誰でもそのディレクトリを作成する必要があります(あるいは、OpenXMLがIsolatedStorageを使用してスプレッドシートを作成しないようにアーカイブライブラリに指示する他の解決策を提案することはできますか?

編集 - 2011年7月14日 - 例外メッセージとスタックトレースを追加することで、他の人がこれを見つけるのを助けることができます。私の研究の間に

Exception: System.ApplicationException 
Message: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) 
Source: mscorlib 
    at System.IO.IsolatedStorage.IsolatedStorageFile.nGetRootDir(IsolatedStorageScope scope) 
    at System.IO.IsolatedStorage.IsolatedStorageFile.InitGlobalsNonRoamingUser(IsolatedStorageScope scope) 
    at System.IO.IsolatedStorage.IsolatedStorageFile.GetRootDir(IsolatedStorageScope scope) 
    at System.IO.IsolatedStorage.IsolatedStorageFile.GetGlobalFileIOPerm(IsolatedStorageScope scope) 
    at System.IO.IsolatedStorage.IsolatedStorageFile.Init(IsolatedStorageScope scope) 
    at System.IO.IsolatedStorage.IsolatedStorageFile.GetStore(IsolatedStorageScope scope, Type domainEvidenceType, Type assemblyEvidenceType) 
    at MS.Internal.IO.Packaging.PackagingUtilities.ReliableIsolatedStorageFileFolder..ctor() 
    at MS.Internal.IO.Packaging.PackagingUtilities.GetDefaultIsolatedStorageFile() 
    at MS.Internal.IO.Packaging.PackagingUtilities.CreateUserScopedIsolatedStorageFileStreamWithRandomName(Int32 retryCount, String& fileName) 
    at MS.Internal.IO.Packaging.SparseMemoryStream.EnsureIsolatedStoreStream() 
    at MS.Internal.IO.Packaging.SparseMemoryStream.SwitchModeIfNecessary() 
    at MS.Internal.IO.Zip.ZipIOFileItemStream.Write(Byte[] buffer, Int32 offset, Int32 count) 
    at System.IO.Compression.DeflateStream.InternalWrite(Byte[] array, Int32 offset, Int32 count, Boolean isAsync) 
    at System.IO.Compression.DeflateStream.Write(Byte[] array, Int32 offset, Int32 count) 
    at MS.Internal.IO.Packaging.CompressStream.Write(Byte[] buffer, Int32 offset, Int32 count) 
    at MS.Internal.IO.Zip.ProgressiveCrcCalculatingStream.Write(Byte[] buffer, Int32 offset, Int32 count) 
    at MS.Internal.IO.Zip.ZipIOModeEnforcingStream.Write(Byte[] buffer, Int32 offset, Int32 count) 
    at System.Xml.XmlUtf8RawTextWriter.FlushBuffer() 
    at System.Xml.XmlUtf8RawTextWriter.WriteAttributeTextBlock(Char* pSrc, Char* pSrcEnd) 
    at System.Xml.XmlUtf8RawTextWriter.WriteString(String text) 
    at System.Xml.XmlWellFormedWriter.WriteString(String text) 
    at DocumentFormat.OpenXml.OpenXmlElement.WriteAttributesTo(XmlWriter xmlWriter) 
    at DocumentFormat.OpenXml.OpenXmlElement.WriteTo(XmlWriter xmlWriter) 
    at DocumentFormat.OpenXml.OpenXmlCompositeElement.WriteContentTo(XmlWriter w) 
    at DocumentFormat.OpenXml.OpenXmlElement.WriteTo(XmlWriter xmlWriter) 
    at DocumentFormat.OpenXml.OpenXmlCompositeElement.WriteContentTo(XmlWriter w) 
    at DocumentFormat.OpenXml.OpenXmlElement.WriteTo(XmlWriter xmlWriter) 
    at DocumentFormat.OpenXml.OpenXmlCompositeElement.WriteContentTo(XmlWriter w) 
    at DocumentFormat.OpenXml.OpenXmlPartRootElement.WriteTo(XmlWriter xmlWriter) 
    at DocumentFormat.OpenXml.OpenXmlPartRootElement.SaveToPart(OpenXmlPart openXmlPart) 
    at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.SavePartContents() 
    at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.Dispose(Boolean disposing) 
    at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.Close() 
+0

これが見つかりました:http://msdn.microsoft.com/en-us/library/3ak841sy.aspx Vistaの情報がWindows Server 2008にも適用される場合は、 C:¥Users¥Default¥AppData¥Local¥Microsoft¥IsolatedStorageまたは C:¥Users¥Default¥AppData¥Roaming¥Microsoft¥隔離された貯蔵所。 したがって、これらの2つのディレクトリを作成し、NETWORK SERVICEにそれらを完全に制御させ、.XLSXファイルの作成は失敗します。 –

+0

私は上記のリンク先のブログ記事でディレクトリを作成し、ソリューションを再作成しようとするとどこにも行きません。私のオプションは、ファイルを小さくするか、またはOpenXMLにIsolatedStorageに切り替わらないようにアーカイブライブラリをインスタンス化する方法があるかどうかを確認することです。 –

+0

OpenStorageがIsolatedStorageを使用しないようにする方法はありません。私はILSpyを使用してそれを使用するかどうかを選択することができましたが、MemoryStreamとIsolatedStorageを切り替えるために使用する高水準変数varを変更する明白な方法はありません。 NET SERVICEアカウントがWindows Server 2008で使用する特定のプロファイル - C:\ Windows \ ServiceProfiles \ NetworkServiceが見つかりましたが、IsolatedStorageフォルダを作成しても役立つものではありません。 –

答えて

4

、私もこのブログの記事に出くわし:http://www.kevinrohrbaugh.com/blog/tag/openxml

を私は自分のアプリケーションが原因道それに、別のユーザーを偽装持つことができませんので、私が最初にそれを却下他のウェブアプリケーションとやりとりして、私はコントロールできません。

しかし、私はProfileListのNETWORK SERVICEのレジストリエントリを削除している可能性があると考えています。同じ結果が得られるかもしれません。

したがって、HKEY_LOCAL_MACHINE¥SOFTWARE¥Microsoft¥Windows NT¥CurrentVersion¥ProfileList¥S-1-5-20の名前をHKEY_LOCAL_MACHINE¥SOFTWARE¥Microsoft¥Windows NT¥CurrentVersion¥ProfileList¥S-1-5-20-私のExcelエクスポートをバックアップして再実行したところ、正常に動作しています。私が言うことができる限り、私はこれを行ったことで否定的な結果は得られません。

0

[私はコメントとしてこれを追加しているだろうが、私には権限がありません...]

私は、これは他の誰かに役立ちます願っています...

私はIIS Expressでアプリを実行していますWindows Server 2008 R2のネットワークサービスとして。 IsolatedStorageFile.GetMachineStoreForDomain()を呼び出して返された独立したストレージストアは、次の場所にあります。

関連する問題