3 번 문에서 다음 예외가 발생합니다. 파일을 읽으려고하지만 읽기 스트림을 열 수 없습니다.Windows에서 IsolatedStorageFileStream에 대한 작업이 허용되지 않습니다.
이것은 샘플 코드 일 뿐이지 만 실제 시나리오는 웹 소켓이 파일에 바이트를 쓰려고하고 다른 프로세스 (음악 플레이어)가 동일한 파일에서 바이트를 읽으려고합니다. 이 시나리오를 달성하고 싶습니다.
IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication();
var writeStream = storage.OpenFile("sample.txt",
System.IO.FileMode.OpenOrCreate,
System.IO.FileAccess.Write,
System.IO.FileShare.Read);
var readStream = storage.OpenFile("sample.txt",
System.IO.FileMode.Open,
System.IO.FileAccess.Read);
System.IO.IsolatedStorage.IsolatedStorageException는 HRESULT = -2146233264 붙 잡혔다 메시지 = 작동 IsolatedStorageFileStream에 허용되지 않습니다. = mscorlib에 스택 트레이스 출처 : System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor에서 (문자열 경로, 하는 FileMode 모드, FileAccess 액세스, 파일 공유 주, INT32 BUFFERSIZE, IsolatedStorageFile의 ISF) System.IO.IsolatedStorage.IsolatedStorageFile에서 . OpenFile FileReadWriteSample.MainPage.Button_Click에서 (문자열 경로, 하는 FileMode 모드, FileAccess 액세스) (개체 보낸 사람, RoutedEventArgs 전자)의 InnerException는 :
두 번째'OpenFile' 호출에'System.IO.FileShare.Read' 매개 변수를 제공하는 시도하고 문제가 해결되는지 확인합니다. –