Przede wszystkim jasne, że używam ASP.NET 4.5 z DefaultAppPool (integrated 4.0). Skonfigurowałem również anonimowy dostęp do użytkownika DefaultAppPool. Dałem wszystkim dostęp do DefaultAppPool. System.Security.Principal.WindowsIdentity.GetCurrent()
Metoda daje mi tego samego użytkownika. Ale po uruchomieniu poniższej linii daje mi wyjątek Access to the path 'XXXX' is denied.
. Następnie dla celów testowania, dałem wszystkie prawa do użytkownika EveryOne
, ale wciąż otrzymuję ten sam błąd. Oto linia kodu. Zwróć uwagę na TRUSExtractToFile wyrzuca błąd odmowy dostępu?
using (ZipArchive archive = new ZipArchive(zipStream))
{
foreach (ZipArchiveEntry file in archive.Entries)
{
file.ExtractToFile(location,true);
}
}
Oto StackTrace,
[UnauthorizedAccessException: Access to the path 'XXX' is denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +10793558
System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) +1352
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) +65
System.IO.Compression.ZipFileExtensions.ExtractToFile(ZipArchiveEntry source, String destinationFileName, Boolean overwrite) +96
XX.XX.XX.ExtractZipFile(Stream zipStream, String location) in XX.cs:44
XX.XX.XX.XX.XX.XX.ExtractZipFile(Stream zipStream, String location) in XXX.cs:17
Czy użytkownik DefaultAppPool ma dostęp (uprawnienie do odczytu/zapisu) do danej ścieżki? – Tim
@Tim, Tak Pełna kontrola. Nadałem też pełną kontrolę każdemu użytkownikowi. – user960567
Czy użytkownik DefaultAppPool ma dostęp Execute/Traverse do wszystkich folderów na ścieżce? –