teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

3

記載修正。アクセス権追加→成功

2018/10/25 04:20

投稿

imudak
imudak

スコア40

title CHANGED
File without changes
body CHANGED
@@ -58,9 +58,8 @@
58
58
  MemoryMappedFileを使ったdllはとある情報を保持しており、この情報はWindowsAppからも
59
59
  WebAppからも更新され共有する必要があります。
60
60
 
61
- # 追記2 アクセス権追加
61
+ # 追記2' アクセス権追加
62
- IUSRとIIS_IUSRSの権限を追加してみましやはりMyApp->MyWeb順で実行すると
62
+ everyoneに権限を追加してみたところCreateOrOpen時例外は回避されました。
63
- UnauthorizedAccessExceptionになりました。
64
63
 
65
64
  ```lang-C#
66
65
  MemoryMappedFileSecurity customSecurity = new MemoryMappedFileSecurity();
@@ -68,14 +67,6 @@
68
67
  new System.Security.AccessControl.AccessRule<MemoryMappedFileRights>(
69
68
  "everyone", MemoryMappedFileRights.FullControl,
70
69
  System.Security.AccessControl.AccessControlType.Allow));
71
- customSecurity.AddAccessRule(
72
- new System.Security.AccessControl.AccessRule<MemoryMappedFileRights>(
73
- "IIS_IUSRS", MemoryMappedFileRights.FullControl,
74
- System.Security.AccessControl.AccessControlType.Allow));
75
- customSecurity.AddAccessRule(
76
- new System.Security.AccessControl.AccessRule<MemoryMappedFileRights>(
77
- "IUSR", MemoryMappedFileRights.FullControl,
78
- System.Security.AccessControl.AccessControlType.Allow));
79
70
 
80
71
  // m_MemoryMappedFile = MemoryMappedFile.CreateOrOpen(name, capacity);
81
72
  m_MemoryMappedFile = MemoryMappedFile.CreateOrOpen(

2

アクセス権追加→失敗

2018/10/25 04:20

投稿

imudak
imudak

スコア40

title CHANGED
File without changes
body CHANGED
@@ -56,4 +56,32 @@
56
56
  3. この一部機能を実現するためにMemoryMappedFileを使ったdllを使う必要があります。
57
57
 
58
58
  MemoryMappedFileを使ったdllはとある情報を保持しており、この情報はWindowsAppからも
59
- WebAppからも更新され共有する必要があります。
59
+ WebAppからも更新され共有する必要があります。
60
+
61
+ # 追記2 アクセス権追加
62
+ IUSRとIIS_IUSRSの権限を追加してみましたが、やはりMyApp->MyWebの順で実行すると
63
+ UnauthorizedAccessExceptionになりました。
64
+
65
+ ```lang-C#
66
+ MemoryMappedFileSecurity customSecurity = new MemoryMappedFileSecurity();
67
+ customSecurity.AddAccessRule(
68
+ new System.Security.AccessControl.AccessRule<MemoryMappedFileRights>(
69
+ "everyone", MemoryMappedFileRights.FullControl,
70
+ System.Security.AccessControl.AccessControlType.Allow));
71
+ customSecurity.AddAccessRule(
72
+ new System.Security.AccessControl.AccessRule<MemoryMappedFileRights>(
73
+ "IIS_IUSRS", MemoryMappedFileRights.FullControl,
74
+ System.Security.AccessControl.AccessControlType.Allow));
75
+ customSecurity.AddAccessRule(
76
+ new System.Security.AccessControl.AccessRule<MemoryMappedFileRights>(
77
+ "IUSR", MemoryMappedFileRights.FullControl,
78
+ System.Security.AccessControl.AccessControlType.Allow));
79
+
80
+ // m_MemoryMappedFile = MemoryMappedFile.CreateOrOpen(name, capacity);
81
+ m_MemoryMappedFile = MemoryMappedFile.CreateOrOpen(
82
+ $@"Global\{name}", capacity,
83
+ MemoryMappedFileAccess.ReadWrite,
84
+ MemoryMappedFileOptions.None,
85
+ customSecurity,
86
+ System.IO.HandleInheritability.Inheritable);
87
+ ```

1

コメントいただいたので追記します。

2018/10/25 03:05

投稿

imudak
imudak

スコア40

title CHANGED
File without changes
body CHANGED
@@ -44,4 +44,16 @@
44
44
  ```
45
45
 
46
46
  ## 結果2) MyWeb -> MyApp.exeの順で実行
47
- →問題なく起動、動作。
47
+ →問題なく起動、動作。
48
+
49
+
50
+ # 追記
51
+ コメントいただいたので追記します。
52
+ まさに業務で使おうとしています…
53
+
54
+ 1. WindowsAppが元々あり、MemoryMappedFileを使ったdllがあります。
55
+ 2. このWindowsAppの一部機能をWebApp化する要望があります。
56
+ 3. この一部機能を実現するためにMemoryMappedFileを使ったdllを使う必要があります。
57
+
58
+ MemoryMappedFileを使ったdllはとある情報を保持しており、この情報はWindowsAppからも
59
+ WebAppからも更新され共有する必要があります。