|
Simone Chiaretta
2010-02-10, 19:46
Digy
2010-02-10, 20:12
Simone Chiaretta
2010-02-10, 23:57
Nicholas Paldino [.NET/C#...
2010-02-13, 06:08
Simone Chiaretta
2010-02-13, 11:29
Simone Chiaretta
2010-02-16, 16:22
digy digy
2010-02-16, 16:39
Noel Lysaght
2010-02-16, 16:56
Simone Chiaretta
2010-02-16, 16:59
Simone Chiaretta
2010-02-16, 16:59
Simone Chiaretta
2010-05-05, 10:06
Simone Chiaretta
2010-05-06, 15:53
Digy
2010-05-06, 16:09
Simone Chiaretta
2010-05-07, 08:08
|
-
Lucene.net in Medium TrustSimone Chiaretta 2010-02-10, 19:46
Hi all,
we are starting to do the final testing with the new release of Subtext which has a Lucene.net based search engine. But we are finding a strange error, related to a SecurityPermission when running in medium trust there is the stack trace of the error: [SecurityException: Request for the permission of type 'System.Security.Permissions. SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.] FileSupport.Sync(FileStream fileStream) +0 Lucene.Net.Store.FSDirectory.Sync(String name) +151 Lucene.Net.Index.SegmentInfos.FinishCommit(Directory dir) +171 Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean create, Boolean closeDir, IndexDeletionPolicy deletionPolicy, Boolean autoCommit, Int32 maxFieldLength, IndexingChain indexingChain, IndexCommit commit) +257 Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean closeDir, IndexDeletionPolicy deletionPolicy, Boolean autoCommit, Int32 maxFieldLength, IndexingChain indexingChain, IndexCommit commit) +110 Lucene.Net.Index.IndexWriter..ctor(Directory d, Analyzer a, MaxFieldLength mfl) +369 Subtext.Framework.Services.SearchEngine.SearchEngineService.EnsureIndexWriter() in SearchEngineService.cs:93 The line of code that causes the error is _writer = new IndexWriter(_directory, _analyzer,IndexWriter.MaxFieldLength.UNLIMITED); where _directory is FSDirectory.Open(new DirectoryInfo(HttpContext.Server.MapPath("~/App_Data")))) We are using one of the latest versions (retrieved from the trunk around the beginning of January) .. 2.9.1 I guess I read you should have fixed the problem in 2.3.2 ( http://issues.apache.org/jira/browse/LUCENENET-169) but this problem is happening again here. Any idea on what is happening here? Thx Simone -- Simone Chiaretta Microsoft MVP ASP.NET - ASPInsider Blog: http://codeclimber.net.nz RSS: http://feeds2.feedburner.com/codeclimber twitter: @simonech Any sufficiently advanced technology is indistinguishable from magic "Life is short, play hard"
-
RE: Lucene.net in Medium TrustDigy 2010-02-10, 20:12
Hi Simone,
Can you try to open/create a file in that directory within your app(without using Lucene.NET) to narrow down the source of the problem. DIGY -----Original Message----- From: Simone Chiaretta [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 10, 2010 9:46 PM To: lucene-net-user Subject: Lucene.net in Medium Trust Hi all, we are starting to do the final testing with the new release of Subtext which has a Lucene.net based search engine. But we are finding a strange error, related to a SecurityPermission when running in medium trust there is the stack trace of the error: [SecurityException: Request for the permission of type 'System.Security.Permissions. SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.] FileSupport.Sync(FileStream fileStream) +0 Lucene.Net.Store.FSDirectory.Sync(String name) +151 Lucene.Net.Index.SegmentInfos.FinishCommit(Directory dir) +171 Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean create, Boolean closeDir, IndexDeletionPolicy deletionPolicy, Boolean autoCommit, Int32 maxFieldLength, IndexingChain indexingChain, IndexCommit commit) +257 Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean closeDir, IndexDeletionPolicy deletionPolicy, Boolean autoCommit, Int32 maxFieldLength, IndexingChain indexingChain, IndexCommit commit) +110 Lucene.Net.Index.IndexWriter..ctor(Directory d, Analyzer a, MaxFieldLength mfl) +369 Subtext.Framework.Services.SearchEngine.SearchEngineService.EnsureIndexWrite r() in SearchEngineService.cs:93 The line of code that causes the error is _writer = new IndexWriter(_directory, _analyzer,IndexWriter.MaxFieldLength.UNLIMITED); where _directory is FSDirectory.Open(new DirectoryInfo(HttpContext.Server.MapPath("~/App_Data")))) We are using one of the latest versions (retrieved from the trunk around the beginning of January) .. 2.9.1 I guess I read you should have fixed the problem in 2.3.2 ( http://issues.apache.org/jira/browse/LUCENENET-169) but this problem is happening again here. Any idea on what is happening here? Thx Simone -- Simone Chiaretta Microsoft MVP ASP.NET - ASPInsider Blog: http://codeclimber.net.nz RSS: http://feeds2.feedburner.com/codeclimber twitter: @simonech Any sufficiently advanced technology is indistinguishable from magic "Life is short, play hard"
-
Re: Lucene.net in Medium TrustSimone Chiaretta 2010-02-10, 23:57
It's the App_Data folder of a web app... it *should* have write access to
it. I'll check it out Simo On Wed, Feb 10, 2010 at 9:12 PM, Digy <[EMAIL PROTECTED]> wrote: > Hi Simone, > > Can you try to open/create a file in that directory within your app(without > using Lucene.NET) to narrow down the source of the problem. > > DIGY > > -----Original Message----- > From: Simone Chiaretta [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, February 10, 2010 9:46 PM > To: lucene-net-user > Subject: Lucene.net in Medium Trust > > Hi all, > we are starting to do the final testing with the new release of Subtext > which has a Lucene.net based search engine. > But we are finding a strange error, related to a SecurityPermission when > running in medium trust > > there is the stack trace of the error: > > [SecurityException: Request for the permission of type > 'System.Security.Permissions. > SecurityPermission, mscorlib, > Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' > failed.] > FileSupport.Sync(FileStream fileStream) +0 > Lucene.Net.Store.FSDirectory.Sync(String name) +151 > Lucene.Net.Index.SegmentInfos.FinishCommit(Directory dir) +171 > Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean > create, Boolean closeDir, IndexDeletionPolicy deletionPolicy, Boolean > autoCommit, Int32 maxFieldLength, IndexingChain indexingChain, > IndexCommit commit) +257 > Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean > closeDir, IndexDeletionPolicy deletionPolicy, Boolean autoCommit, > Int32 maxFieldLength, IndexingChain indexingChain, IndexCommit commit) > +110 > Lucene.Net.Index.IndexWriter..ctor(Directory d, Analyzer a, > MaxFieldLength mfl) +369 > > > Subtext.Framework.Services.SearchEngine.SearchEngineService.EnsureIndexWrite > r() > in SearchEngineService.cs:93 > > The line of code that causes the error is > > _writer = new IndexWriter(_directory, > _analyzer,IndexWriter.MaxFieldLength.UNLIMITED); > > where _directory is > FSDirectory.Open(new > DirectoryInfo(HttpContext.Server.MapPath("~/App_Data")))) > > We are using one of the latest versions (retrieved from the trunk around > the > beginning of January) .. 2.9.1 I guess > > I read you should have fixed the problem in 2.3.2 ( > http://issues.apache.org/jira/browse/LUCENENET-169) but this problem is > happening again here. > > Any idea on what is happening here? > > Thx > Simone > > -- > Simone Chiaretta > Microsoft MVP ASP.NET - ASPInsider > Blog: http://codeclimber.net.nz > RSS: http://feeds2.feedburner.com/codeclimber > twitter: @simonech > > Any sufficiently advanced technology is indistinguishable from magic > "Life is short, play hard" > > -- Simone Chiaretta Microsoft MVP ASP.NET - ASPInsider Blog: http://codeclimber.net.nz RSS: http://feeds2.feedburner.com/codeclimber twitter: @simonech Any sufficiently advanced technology is indistinguishable from magic "Life is short, play hard"
-
RE: Lucene.net in Medium TrustNicholas Paldino [.NET/C#... 2010-02-13, 06:08
Simone,
Was this ever resolved? Was it a permissions issue on the App_Data folder, or something else? - Nick -----Original Message----- From: Simone Chiaretta [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 10, 2010 6:57 PM To: [EMAIL PROTECTED] Subject: Re: Lucene.net in Medium Trust It's the App_Data folder of a web app... it *should* have write access to it. I'll check it out Simo On Wed, Feb 10, 2010 at 9:12 PM, Digy <[EMAIL PROTECTED]> wrote: > Hi Simone, > > Can you try to open/create a file in that directory within your app(without > using Lucene.NET) to narrow down the source of the problem. > > DIGY > > -----Original Message----- > From: Simone Chiaretta [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, February 10, 2010 9:46 PM > To: lucene-net-user > Subject: Lucene.net in Medium Trust > > Hi all, > we are starting to do the final testing with the new release of Subtext > which has a Lucene.net based search engine. > But we are finding a strange error, related to a SecurityPermission when > running in medium trust > > there is the stack trace of the error: > > [SecurityException: Request for the permission of type > 'System.Security.Permissions. > SecurityPermission, mscorlib, > Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' > failed.] > FileSupport.Sync(FileStream fileStream) +0 > Lucene.Net.Store.FSDirectory.Sync(String name) +151 > Lucene.Net.Index.SegmentInfos.FinishCommit(Directory dir) +171 > Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean > create, Boolean closeDir, IndexDeletionPolicy deletionPolicy, Boolean > autoCommit, Int32 maxFieldLength, IndexingChain indexingChain, > IndexCommit commit) +257 > Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean > closeDir, IndexDeletionPolicy deletionPolicy, Boolean autoCommit, > Int32 maxFieldLength, IndexingChain indexingChain, IndexCommit commit) > +110 > Lucene.Net.Index.IndexWriter..ctor(Directory d, Analyzer a, > MaxFieldLength mfl) +369 > > > Subtext.Framework.Services.SearchEngine.SearchEngineService.EnsureIndexWrite > r() > in SearchEngineService.cs:93 > > The line of code that causes the error is > > _writer = new IndexWriter(_directory, > _analyzer,IndexWriter.MaxFieldLength.UNLIMITED); > > where _directory is > FSDirectory.Open(new > DirectoryInfo(HttpContext.Server.MapPath("~/App_Data")))) > > We are using one of the latest versions (retrieved from the trunk around > the > beginning of January) .. 2.9.1 I guess > > I read you should have fixed the problem in 2.3.2 ( > http://issues.apache.org/jira/browse/LUCENENET-169) but this problem is > happening again here. > > Any idea on what is happening here? > > Thx > Simone > > -- > Simone Chiaretta > Microsoft MVP ASP.NET - ASPInsider > Blog: http://codeclimber.net.nz > RSS: http://feeds2.feedburner.com/codeclimber > twitter: @simonech > > Any sufficiently advanced technology is indistinguishable from magic > "Life is short, play hard" > > -- Simone Chiaretta Microsoft MVP ASP.NET - ASPInsider Blog: http://codeclimber.net.nz RSS: http://feeds2.feedburner.com/codeclimber twitter: @simonech Any sufficiently advanced technology is indistinguishable from magic "Life is short, play hard"
-
Re: Lucene.net in Medium TrustSimone Chiaretta 2010-02-13, 11:29
Nick, I didn't have time to work on this issue.. I asked to the guy that
reported the problem to see if it was a permission problem, but he never get back to me. But I guess it's not as permission problem as he said that with full trust it worked On Sat, Feb 13, 2010 at 7:08 AM, Nicholas Paldino [.NET/C# MVP] < [EMAIL PROTECTED]> wrote: > Simone, > > Was this ever resolved? Was it a permissions issue on the App_Data > folder, or something else? > > - Nick > > -----Original Message----- > From: Simone Chiaretta [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, February 10, 2010 6:57 PM > To: [EMAIL PROTECTED] > Subject: Re: Lucene.net in Medium Trust > > It's the App_Data folder of a web app... it *should* have write access to > it. > I'll check it out > Simo > > On Wed, Feb 10, 2010 at 9:12 PM, Digy <[EMAIL PROTECTED]> wrote: > > > Hi Simone, > > > > Can you try to open/create a file in that directory within your > app(without > > using Lucene.NET) to narrow down the source of the problem. > > > > DIGY > > > > -----Original Message----- > > From: Simone Chiaretta [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, February 10, 2010 9:46 PM > > To: lucene-net-user > > Subject: Lucene.net in Medium Trust > > > > Hi all, > > we are starting to do the final testing with the new release of Subtext > > which has a Lucene.net based search engine. > > But we are finding a strange error, related to a SecurityPermission when > > running in medium trust > > > > there is the stack trace of the error: > > > > [SecurityException: Request for the permission of type > > 'System.Security.Permissions. > > SecurityPermission, mscorlib, > > Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' > > failed.] > > FileSupport.Sync(FileStream fileStream) +0 > > Lucene.Net.Store.FSDirectory.Sync(String name) +151 > > Lucene.Net.Index.SegmentInfos.FinishCommit(Directory dir) +171 > > Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean > > create, Boolean closeDir, IndexDeletionPolicy deletionPolicy, Boolean > > autoCommit, Int32 maxFieldLength, IndexingChain indexingChain, > > IndexCommit commit) +257 > > Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean > > closeDir, IndexDeletionPolicy deletionPolicy, Boolean autoCommit, > > Int32 maxFieldLength, IndexingChain indexingChain, IndexCommit commit) > > +110 > > Lucene.Net.Index.IndexWriter..ctor(Directory d, Analyzer a, > > MaxFieldLength mfl) +369 > > > > > > > > Subtext.Framework.Services.SearchEngine.SearchEngineService.EnsureIndexWrite > > r() > > in SearchEngineService.cs:93 > > > > The line of code that causes the error is > > > > _writer = new IndexWriter(_directory, > > _analyzer,IndexWriter.MaxFieldLength.UNLIMITED); > > > > where _directory is > > FSDirectory.Open(new > > DirectoryInfo(HttpContext.Server.MapPath("~/App_Data")))) > > > > We are using one of the latest versions (retrieved from the trunk around > > the > > beginning of January) .. 2.9.1 I guess > > > > I read you should have fixed the problem in 2.3.2 ( > > http://issues.apache.org/jira/browse/LUCENENET-169) but this problem is > > happening again here. > > > > Any idea on what is happening here? > > > > Thx > > Simone > > > > -- > > Simone Chiaretta > > Microsoft MVP ASP.NET - ASPInsider > > Blog: http://codeclimber.net.nz > > RSS: http://feeds2.feedburner.com/codeclimber > > twitter: @simonech > > > > Any sufficiently advanced technology is indistinguishable from magic > > "Life is short, play hard" > > > > > > > -- > Simone Chiaretta > Microsoft MVP ASP.NET - ASPInsider > Blog: http://codeclimber.net.nz > RSS: http://feeds2.feedburner.com/codeclimber > twitter: @simonech > > Any sufficiently advanced technology is indistinguishable from magic > "Life is short, play hard" > -- Simone Chiaretta Microsoft MVP ASP.NET - ASPInsider Blog: http://codeclimber.net.nz RSS: http://feeds2.feedburner.com/codeclimber twitter: @simonech Any sufficiently advanced technology is indistinguishable from magic "Life is short, play hard"
-
Re: Lucene.net in Medium TrustSimone Chiaretta 2010-02-16, 16:22
This is the email from the guy that reported the error:
It seems like adding the permission to App_Data (where the indexes are located) didn't help. Any ideas? Simone ----------------------------- After adding Read/Write/Modify permissions to App_Data for "NETWORK SERVICE" (what the app pool is running under), I got the same permissions issue... but then also got a new one. I added the permissions and did a full IISRESET. I then hit the successfully upgraded site (going to the admin page). The login screen for the admin site came up and I entered my credentials. That's when I got the exception we saw earlier: [SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.] FileSupport.Sync(FileStream fileStream) +0 Lucene.Net.Store.FSDirectory.Sync(String name) +151 Lucene.Net.Index.SegmentInfos.FinishCommit(Directory dir) +171 Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean create, Boolean closeDir, IndexDeletionPolicy deletionPolicy, Boolean autoCommit, Int32 maxFieldLength, IndexingChain indexingChain, IndexCommit commit) +257 Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean closeDir, IndexDeletionPolicy deletionPolicy, Boolean autoCommit, Int32 maxFieldLength, IndexingChain indexingChain, IndexCommit commit) +110 Lucene.Net.Index.IndexWriter..ctor(Directory d, Analyzer a, MaxFieldLength mfl) +369 Subtext.Framework.Services.SearchEngine.SearchEngineService.EnsureIndexWriter() in SearchEngineService.cs:93 HOWEVER, if I hit reload, I get a new exception: [LockObtainFailedException: Lock obtain timed out: NativeFSLock@C:\dev \subtext\trunk\src\Subtext. Web\App_Data\write.lock] Lucene.Net.Store.Lock.Obtain(Int64 lockWaitTimeout) +574 Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean create, Boolean closeDir, IndexDeletionPolicy deletionPolicy, Boolean autoCommit, Int32 maxFieldLength, IndexingChain indexingChain, IndexCommit commit) +154 Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean closeDir, IndexDeletionPolicy deletionPolicy, Boolean autoCommit, Int32 maxFieldLength, IndexingChain indexingChain, IndexCommit commit) +110 Lucene.Net.Index.IndexWriter..ctor(Directory d, Analyzer a, MaxFieldLength mfl) +369 Subtext.Framework.Services.SearchEngine.SearchEngineService.EnsureIndexWriter() in SearchEngineService.cs:93 Subtext.Framework.Services.SearchEngine.SearchEngineService.DoWriterAction(Func`2 action) in SearchEngineService.cs:77 Subtext.Framework.Services.SearchEngine.SearchEngineService.get_Searcher() in SearchEngineService.cs:100 Subtext.Framework.Services.SearchEngine.SearchEngineService.GetIndexedEntryCount(Int32 blogId) in SearchEngineService.cs:159 Subtext.Web.Admin.Pages.HomePageDefault.get_IndexedEntryCount() in C:\dev\subtext\trunk\src\Subtext.Web\aspx\Admin\default.aspx.cs:43 Looking in the App_Data folder, there aren't any .lock files. Just the .mdf that comes with the source that I'm not using (I have SQL Server with a backup copy of my real database so I can test). Subsequent reloads yield the lock timeout exception over and over. I tried adding Read/Write/Modify to "EVERYONE" on "App_Data," did IISRESET, and got the same results. ------------ On Sat, Feb 13, 2010 at 3:29 AM, Simone Chiaretta < [EMAIL PROTECTED]> wrote: > Nick, I didn't have time to work on this issue.. I asked to the guy that > reported the problem to see if it was a permission problem, but he never get > back to me. > But I guess it's not as permission problem as he said that with full trust > it worked > > > On Sat, Feb 13, 2010 at 7:08 AM, Nicholas Paldino [.NET/C# MVP] < > [EMAIL PROTECTED]> wrote: > >> Simone, >> >> Was this ever resolved? Was it a permissions issue on the App_Data >> folder, or something else? >> >> - Nick >> >> -----Original Message----- >> From: Simone Chiaretta [mailto:[EMAIL PROTECTED]] Simone Chiaretta Microsoft MVP ASP.NET - ASPInsider Blog: http://codeclimber.net.nz RSS: http://feeds2.feedburner.com/codeclimber twitter: @simonech Any sufficiently advanced technology is indistinguishable from magic "Life is short, play hard"
-
Re: Lucene.net in Medium Trustdigy digy 2010-02-16, 16:39
The reason may be the "FlushFileBuffers" in "SupportClass.FileSupport.Sync".
Can you change the code as below and try again? public static void Sync(System.IO.FileStream fileStream) { if (fileStream == null) throw new ArgumentNullException("fileStream"); fileStream.Flush(); } DIGY On Tue, Feb 16, 2010 at 6:22 PM, Simone Chiaretta < [EMAIL PROTECTED]> wrote: > This is the email from the guy that reported the error: > > It seems like adding the permission to App_Data (where the indexes are > located) didn't help. > > Any ideas? > Simone > > ----------------------------- > > After adding Read/Write/Modify permissions to App_Data for "NETWORK > SERVICE" (what the app pool is running under), I got the same > permissions issue... but then also got a new one. > > I added the permissions and did a full IISRESET. I then hit the > successfully upgraded site (going to the admin page). The login screen > for the admin site came up and I entered my credentials. That's when I > got the exception we saw earlier: > > [SecurityException: Request for the permission of type > 'System.Security.Permissions.SecurityPermission, mscorlib, > Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' > failed.] > FileSupport.Sync(FileStream fileStream) +0 > Lucene.Net.Store.FSDirectory.Sync(String name) +151 > Lucene.Net.Index.SegmentInfos.FinishCommit(Directory dir) +171 > Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean > create, Boolean closeDir, IndexDeletionPolicy deletionPolicy, Boolean > autoCommit, Int32 maxFieldLength, IndexingChain indexingChain, > IndexCommit commit) +257 > Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean > closeDir, IndexDeletionPolicy deletionPolicy, Boolean autoCommit, > Int32 maxFieldLength, IndexingChain indexingChain, IndexCommit commit) > +110 > Lucene.Net.Index.IndexWriter..ctor(Directory d, Analyzer a, > MaxFieldLength mfl) +369 > > > Subtext.Framework.Services.SearchEngine.SearchEngineService.EnsureIndexWriter() > in SearchEngineService.cs:93 > > HOWEVER, if I hit reload, I get a new exception: > > [LockObtainFailedException: Lock obtain timed out: NativeFSLock@C:\dev > \subtext\trunk\src\Subtext. > Web\App_Data\write.lock] > Lucene.Net.Store.Lock.Obtain(Int64 lockWaitTimeout) +574 > Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean > create, Boolean closeDir, IndexDeletionPolicy deletionPolicy, Boolean > autoCommit, Int32 maxFieldLength, IndexingChain indexingChain, > IndexCommit commit) +154 > Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean > closeDir, IndexDeletionPolicy deletionPolicy, Boolean autoCommit, > Int32 maxFieldLength, IndexingChain indexingChain, IndexCommit commit) > +110 > Lucene.Net.Index.IndexWriter..ctor(Directory d, Analyzer a, > MaxFieldLength mfl) +369 > > > Subtext.Framework.Services.SearchEngine.SearchEngineService.EnsureIndexWriter() > in SearchEngineService.cs:93 > > > Subtext.Framework.Services.SearchEngine.SearchEngineService.DoWriterAction(Func`2 > action) in SearchEngineService.cs:77 > > Subtext.Framework.Services.SearchEngine.SearchEngineService.get_Searcher() > in SearchEngineService.cs:100 > > > Subtext.Framework.Services.SearchEngine.SearchEngineService.GetIndexedEntryCount(Int32 > blogId) in SearchEngineService.cs:159 > Subtext.Web.Admin.Pages.HomePageDefault.get_IndexedEntryCount() in > C:\dev\subtext\trunk\src\Subtext.Web\aspx\Admin\default.aspx.cs:43 > > Looking in the App_Data folder, there aren't any .lock files. Just > the .mdf that comes with the source that I'm not using (I have SQL > Server with a backup copy of my real database so I can test). > > Subsequent reloads yield the lock timeout exception over and over. > > I tried adding Read/Write/Modify to "EVERYONE" on "App_Data," did > IISRESET, and got the same results. > > ------------ > > > On Sat, Feb 13, 2010 at 3:29 AM, Simone Chiaretta < > [EMAIL PROTECTED]> wrote: > > > Nick, I didn't have time to work on this issue.. I asked to the guy that
-
Re: Lucene.net in Medium TrustNoel Lysaght 2010-02-16, 16:56
If the web-site is using "Integrated Security" then the writes will happen
under the identity of the caller. In this case the folder where the index data is stored will need to give Read/Write permissions to Authenticated Users (which is a group on the local machine). Ideally the writes should be happing in some form of Windows Service etc, I presume this was covered earlier on. Doing writes in a web-site/web-service directly is a bad idea because of concurrency issues on the writers. Kind Regards Noel -------------------------------------------------- From: "Simone Chiaretta" <[EMAIL PROTECTED]> Sent: Tuesday, February 16, 2010 4:22 PM To: <[EMAIL PROTECTED]> Subject: Re: Lucene.net in Medium Trust > This is the email from the guy that reported the error: > > It seems like adding the permission to App_Data (where the indexes are > located) didn't help. > > Any ideas? > Simone > > ----------------------------- > > After adding Read/Write/Modify permissions to App_Data for "NETWORK > SERVICE" (what the app pool is running under), I got the same > permissions issue... but then also got a new one. > > I added the permissions and did a full IISRESET. I then hit the > successfully upgraded site (going to the admin page). The login screen > for the admin site came up and I entered my credentials. That's when I > got the exception we saw earlier: > > [SecurityException: Request for the permission of type > 'System.Security.Permissions.SecurityPermission, mscorlib, > Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' > failed.] > FileSupport.Sync(FileStream fileStream) +0 > Lucene.Net.Store.FSDirectory.Sync(String name) +151 > Lucene.Net.Index.SegmentInfos.FinishCommit(Directory dir) +171 > Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean > create, Boolean closeDir, IndexDeletionPolicy deletionPolicy, Boolean > autoCommit, Int32 maxFieldLength, IndexingChain indexingChain, > IndexCommit commit) +257 > Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean > closeDir, IndexDeletionPolicy deletionPolicy, Boolean autoCommit, > Int32 maxFieldLength, IndexingChain indexingChain, IndexCommit commit) > +110 > Lucene.Net.Index.IndexWriter..ctor(Directory d, Analyzer a, > MaxFieldLength mfl) +369 > > Subtext.Framework.Services.SearchEngine.SearchEngineService.EnsureIndexWriter() > in SearchEngineService.cs:93 > > HOWEVER, if I hit reload, I get a new exception: > > [LockObtainFailedException: Lock obtain timed out: NativeFSLock@C:\dev > \subtext\trunk\src\Subtext. > Web\App_Data\write.lock] > Lucene.Net.Store.Lock.Obtain(Int64 lockWaitTimeout) +574 > Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean > create, Boolean closeDir, IndexDeletionPolicy deletionPolicy, Boolean > autoCommit, Int32 maxFieldLength, IndexingChain indexingChain, > IndexCommit commit) +154 > Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean > closeDir, IndexDeletionPolicy deletionPolicy, Boolean autoCommit, > Int32 maxFieldLength, IndexingChain indexingChain, IndexCommit commit) > +110 > Lucene.Net.Index.IndexWriter..ctor(Directory d, Analyzer a, > MaxFieldLength mfl) +369 > > Subtext.Framework.Services.SearchEngine.SearchEngineService.EnsureIndexWriter() > in SearchEngineService.cs:93 > > Subtext.Framework.Services.SearchEngine.SearchEngineService.DoWriterAction(Func`2 > action) in SearchEngineService.cs:77 > > Subtext.Framework.Services.SearchEngine.SearchEngineService.get_Searcher() > in SearchEngineService.cs:100 > > Subtext.Framework.Services.SearchEngine.SearchEngineService.GetIndexedEntryCount(Int32 > blogId) in SearchEngineService.cs:159 > Subtext.Web.Admin.Pages.HomePageDefault.get_IndexedEntryCount() in > C:\dev\subtext\trunk\src\Subtext.Web\aspx\Admin\default.aspx.cs:43 > > Looking in the App_Data folder, there aren't any .lock files. Just > the .mdf that comes with the source that I'm not using (I have SQL > Server with a backup copy of my real database so I can test).
-
Re: Lucene.net in Medium TrustSimone Chiaretta 2010-02-16, 16:59
I'll have a try.. thx
Simo On Tue, Feb 16, 2010 at 8:39 AM, digy digy <[EMAIL PROTECTED]> wrote: > The reason may be the "FlushFileBuffers" in > "SupportClass.FileSupport.Sync". > Can you change the code as below and try again? > > public static void Sync(System.IO.FileStream fileStream) > { > if (fileStream == null) throw new ArgumentNullException("fileStream"); > fileStream.Flush(); > } > > DIGY > > On Tue, Feb 16, 2010 at 6:22 PM, Simone Chiaretta < > [EMAIL PROTECTED]> wrote: > > > This is the email from the guy that reported the error: > > > > It seems like adding the permission to App_Data (where the indexes are > > located) didn't help. > > > > Any ideas? > > Simone > > > > ----------------------------- > > > > After adding Read/Write/Modify permissions to App_Data for "NETWORK > > SERVICE" (what the app pool is running under), I got the same > > permissions issue... but then also got a new one. > > > > I added the permissions and did a full IISRESET. I then hit the > > successfully upgraded site (going to the admin page). The login screen > > for the admin site came up and I entered my credentials. That's when I > > got the exception we saw earlier: > > > > [SecurityException: Request for the permission of type > > 'System.Security.Permissions.SecurityPermission, mscorlib, > > Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' > > failed.] > > FileSupport.Sync(FileStream fileStream) +0 > > Lucene.Net.Store.FSDirectory.Sync(String name) +151 > > Lucene.Net.Index.SegmentInfos.FinishCommit(Directory dir) +171 > > Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean > > create, Boolean closeDir, IndexDeletionPolicy deletionPolicy, Boolean > > autoCommit, Int32 maxFieldLength, IndexingChain indexingChain, > > IndexCommit commit) +257 > > Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean > > closeDir, IndexDeletionPolicy deletionPolicy, Boolean autoCommit, > > Int32 maxFieldLength, IndexingChain indexingChain, IndexCommit commit) > > +110 > > Lucene.Net.Index.IndexWriter..ctor(Directory d, Analyzer a, > > MaxFieldLength mfl) +369 > > > > > > > Subtext.Framework.Services.SearchEngine.SearchEngineService.EnsureIndexWriter() > > in SearchEngineService.cs:93 > > > > HOWEVER, if I hit reload, I get a new exception: > > > > [LockObtainFailedException: Lock obtain timed out: NativeFSLock@C:\dev > > \subtext\trunk\src\Subtext. > > Web\App_Data\write.lock] > > Lucene.Net.Store.Lock.Obtain(Int64 lockWaitTimeout) +574 > > Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean > > create, Boolean closeDir, IndexDeletionPolicy deletionPolicy, Boolean > > autoCommit, Int32 maxFieldLength, IndexingChain indexingChain, > > IndexCommit commit) +154 > > Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean > > closeDir, IndexDeletionPolicy deletionPolicy, Boolean autoCommit, > > Int32 maxFieldLength, IndexingChain indexingChain, IndexCommit commit) > > +110 > > Lucene.Net.Index.IndexWriter..ctor(Directory d, Analyzer a, > > MaxFieldLength mfl) +369 > > > > > > > Subtext.Framework.Services.SearchEngine.SearchEngineService.EnsureIndexWriter() > > in SearchEngineService.cs:93 > > > > > > > Subtext.Framework.Services.SearchEngine.SearchEngineService.DoWriterAction(Func`2 > > action) in SearchEngineService.cs:77 > > > > > Subtext.Framework.Services.SearchEngine.SearchEngineService.get_Searcher() > > in SearchEngineService.cs:100 > > > > > > > Subtext.Framework.Services.SearchEngine.SearchEngineService.GetIndexedEntryCount(Int32 > > blogId) in SearchEngineService.cs:159 > > Subtext.Web.Admin.Pages.HomePageDefault.get_IndexedEntryCount() in > > C:\dev\subtext\trunk\src\Subtext.Web\aspx\Admin\default.aspx.cs:43 > > > > Looking in the App_Data folder, there aren't any .lock files. Just > > the .mdf that comes with the source that I'm not using (I have SQL > > Server with a backup copy of my real database so I can test). > > > > Subsequent reloads yield the lock timeout exception over and over. Simone Chiaretta Microsoft MVP ASP.NET - ASPInsider Blog: http://codeclimber.net.nz RSS: http://feeds2.feedburner.com/codeclimber twitter: @simonech Any sufficiently advanced technology is indistinguishable from magic "Life is short, play hard"
-
Re: Lucene.net in Medium TrustSimone Chiaretta 2010-02-16, 16:59
Not using integrated security.
I know that using a separated process will be better... but if I had the possibility to install a windows service probably I'd not have the problem of medium trust :) The reason is that I've got a public opensource blogging engine that must run on cheap hosting, and they don't allow full trust and for sure not services :) Simo On Tue, Feb 16, 2010 at 8:56 AM, Noel Lysaght <[EMAIL PROTECTED]> wrote: > If the web-site is using "Integrated Security" then the writes will happen > under the identity of the caller. In this case the folder where the index > data is stored will need to give Read/Write permissions to Authenticated > Users (which is a group on the local machine). > > Ideally the writes should be happing in some form of Windows Service etc, I > presume this was covered earlier on. Doing writes in a web-site/web-service > directly is a bad idea because of concurrency issues on the writers. > > Kind Regards > Noel > > -------------------------------------------------- > From: "Simone Chiaretta" <[EMAIL PROTECTED]> > Sent: Tuesday, February 16, 2010 4:22 PM > > To: <[EMAIL PROTECTED]> > Subject: Re: Lucene.net in Medium Trust > > This is the email from the guy that reported the error: >> >> It seems like adding the permission to App_Data (where the indexes are >> located) didn't help. >> >> Any ideas? >> Simone >> >> ----------------------------- >> >> After adding Read/Write/Modify permissions to App_Data for "NETWORK >> SERVICE" (what the app pool is running under), I got the same >> permissions issue... but then also got a new one. >> >> I added the permissions and did a full IISRESET. I then hit the >> successfully upgraded site (going to the admin page). The login screen >> for the admin site came up and I entered my credentials. That's when I >> got the exception we saw earlier: >> >> [SecurityException: Request for the permission of type >> 'System.Security.Permissions.SecurityPermission, mscorlib, >> Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' >> failed.] >> FileSupport.Sync(FileStream fileStream) +0 >> Lucene.Net.Store.FSDirectory.Sync(String name) +151 >> Lucene.Net.Index.SegmentInfos.FinishCommit(Directory dir) +171 >> Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean >> create, Boolean closeDir, IndexDeletionPolicy deletionPolicy, Boolean >> autoCommit, Int32 maxFieldLength, IndexingChain indexingChain, >> IndexCommit commit) +257 >> Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean >> closeDir, IndexDeletionPolicy deletionPolicy, Boolean autoCommit, >> Int32 maxFieldLength, IndexingChain indexingChain, IndexCommit commit) >> +110 >> Lucene.Net.Index.IndexWriter..ctor(Directory d, Analyzer a, >> MaxFieldLength mfl) +369 >> >> >> Subtext.Framework.Services.SearchEngine.SearchEngineService.EnsureIndexWriter() >> in SearchEngineService.cs:93 >> >> HOWEVER, if I hit reload, I get a new exception: >> >> [LockObtainFailedException: Lock obtain timed out: NativeFSLock@C:\dev >> \subtext\trunk\src\Subtext. >> Web\App_Data\write.lock] >> Lucene.Net.Store.Lock.Obtain(Int64 lockWaitTimeout) +574 >> Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean >> create, Boolean closeDir, IndexDeletionPolicy deletionPolicy, Boolean >> autoCommit, Int32 maxFieldLength, IndexingChain indexingChain, >> IndexCommit commit) +154 >> Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean >> closeDir, IndexDeletionPolicy deletionPolicy, Boolean autoCommit, >> Int32 maxFieldLength, IndexingChain indexingChain, IndexCommit commit) >> +110 >> Lucene.Net.Index.IndexWriter..ctor(Directory d, Analyzer a, >> MaxFieldLength mfl) +369 >> >> >> Subtext.Framework.Services.SearchEngine.SearchEngineService.EnsureIndexWriter() >> in SearchEngineService.cs:93 >> >> >> Subtext.Framework.Services.SearchEngine.SearchEngineService.DoWriterAction(Func`2 >> action) in SearchEngineService.cs:77 >> >> Subtext.Framework.Services.SearchEngine.SearchEngineService.get_Searcher() Simone Chiaretta Microsoft MVP ASP.NET - ASPInsider Blog: http://codeclimber.net.nz RSS: http://feeds2.feedburner.com/codeclimber twitter: @simonech Any sufficiently advanced technology is indistinguishable from magic "Life is short, play hard"
-
Re: Lucene.net in Medium TrustSimone Chiaretta 2010-05-05, 10:06
Hi All,
sorry for taking so long to work on the issue: Debugging so far, and found out that the problem was not in the open method, but in the static constructor itself 1 - FSDirectory static constructor: public static readonly System.String LOCK_DIR SupportClass.AppSettings.Get("Lucene.Net.lockDir", System.IO.Path.GetTempPath()); GetTempPath raises a permission exception when running in medium trust... since this is even an Obsolete method I just removed the line 2 - Utils.Constants static constructor: System.Environment.GetEnvironmentVariable: raises an exception medium trust as well: The lines with problems are: - public static readonly System.String OS_NAME System.Environment.GetEnvironmentVariable("OS") ?? "Linux"; Just hardcoded "Windows" as I'm not running on other machines... I also searched for usages and it's used only in two lines: one in the Directory Open method in an if/else statement that does the same things in both trees, and the other is in the IndexWriter where the DEFAULT_MAX_SYNC_PAUSE_SECONDS is set based on whether it's Windows - public static readonly System.String OS_ARCH System.Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE"); Used only as debugging info, so hardcoded it to x86 - public static readonly System.String OS_VERSION System.Environment.OSVersion.ToString() Used only in debugging, hardcoded to String.Empty With these changes it works even when setting the trust level to medium: tested adding <trust level="Medium" originUrl=".*" /> in the config file of the applications hope this helps Simo PS: I also found this blog post that talks about the same problems: http://www.klopfenstein.net/lorenz.aspx/lucene.net-on-medium-trust-nhibernate-search-part-2 <http://www.klopfenstein.net/lorenz.aspx/lucene.net-on-medium-trust-nhibernate-search-part-2>Too bad he didn't publish any code, but only released the compiled build file. On Tue, Feb 16, 2010 at 6:39 PM, digy digy <[EMAIL PROTECTED]> wrote: > The reason may be the "FlushFileBuffers" in > "SupportClass.FileSupport.Sync". > Can you change the code as below and try again? > > public static void Sync(System.IO.FileStream fileStream) > { > if (fileStream == null) throw new ArgumentNullException("fileStream"); > fileStream.Flush(); > } > > DIGY > > On Tue, Feb 16, 2010 at 6:22 PM, Simone Chiaretta < > [EMAIL PROTECTED]> wrote: > > > This is the email from the guy that reported the error: > > > > It seems like adding the permission to App_Data (where the indexes are > > located) didn't help. > > > > Any ideas? > > Simone > > > > ----------------------------- > > > > After adding Read/Write/Modify permissions to App_Data for "NETWORK > > SERVICE" (what the app pool is running under), I got the same > > permissions issue... but then also got a new one. > > > > I added the permissions and did a full IISRESET. I then hit the > > successfully upgraded site (going to the admin page). The login screen > > for the admin site came up and I entered my credentials. That's when I > > got the exception we saw earlier: > > > > [SecurityException: Request for the permission of type > > 'System.Security.Permissions.SecurityPermission, mscorlib, > > Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' > > failed.] > > FileSupport.Sync(FileStream fileStream) +0 > > Lucene.Net.Store.FSDirectory.Sync(String name) +151 > > Lucene.Net.Index.SegmentInfos.FinishCommit(Directory dir) +171 > > Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean > > create, Boolean closeDir, IndexDeletionPolicy deletionPolicy, Boolean > > autoCommit, Int32 maxFieldLength, IndexingChain indexingChain, > > IndexCommit commit) +257 > > Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean > > closeDir, IndexDeletionPolicy deletionPolicy, Boolean autoCommit, > > Int32 maxFieldLength, IndexingChain indexingChain, IndexCommit commit) > > +110 > > Lucene.Net.Index.IndexWriter..ctor(Directory d, Analyzer a, Simone Chiaretta Microsoft MVP ASP.NET - ASPInsider Blog: http://codeclimber.net.nz RSS: http://feeds2.feedburner.com/codeclimber twitter: @simonech Any sufficiently advanced technology is indistinguishable from magic "Life is short, play hard"
-
Re: Lucene.net in Medium TrustSimone Chiaretta 2010-05-06, 15:53
Should I send a patch? Should I file a bug?
Simone On Wed, May 5, 2010 at 12:06 PM, Simone Chiaretta < [EMAIL PROTECTED]> wrote: > Hi All, > sorry for taking so long to work on the issue: > Debugging so far, and found out that the problem was not in the open > method, but in the static constructor itself > > 1 - FSDirectory static constructor: > public static readonly System.String LOCK_DIR > SupportClass.AppSettings.Get("Lucene.Net.lockDir", > System.IO.Path.GetTempPath()); > GetTempPath raises a permission exception when running in medium trust... > since this is even an Obsolete method I just removed the line > > 2 - Utils.Constants static constructor: > System.Environment.GetEnvironmentVariable: raises an exception medium trust > as well: > The lines with problems are: > > - public static readonly System.String OS_NAME > System.Environment.GetEnvironmentVariable("OS") ?? "Linux"; > Just hardcoded "Windows" as I'm not running on other machines... I also > searched for usages and it's used only in two lines: one in the Directory > Open method in an if/else statement that does the same things in both trees, > and the other is in the IndexWriter where the DEFAULT_MAX_SYNC_PAUSE_SECONDS > is set based on whether it's Windows > - public static readonly System.String OS_ARCH > System.Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE"); > Used only as debugging info, so hardcoded it to x86 > - public static readonly System.String OS_VERSION > System.Environment.OSVersion.ToString() > Used only in debugging, hardcoded to String.Empty > > > With these changes it works even when setting the trust level to medium: > tested adding > <trust level="Medium" originUrl=".*" /> > in the config file of the applications > > hope this helps > Simo > > PS: I also found this blog post that talks about the same problems: > > http://www.klopfenstein.net/lorenz.aspx/lucene.net-on-medium-trust-nhibernate-search-part-2 > <http://www.klopfenstein.net/lorenz.aspx/lucene.net-on-medium-trust-nhibernate-search-part-2>Too > bad he didn't publish any code, but only released the compiled build file. > > On Tue, Feb 16, 2010 at 6:39 PM, digy digy <[EMAIL PROTECTED]> wrote: > >> The reason may be the "FlushFileBuffers" in >> "SupportClass.FileSupport.Sync". >> Can you change the code as below and try again? >> >> public static void Sync(System.IO.FileStream fileStream) >> { >> if (fileStream == null) throw new ArgumentNullException("fileStream"); >> fileStream.Flush(); >> } >> >> DIGY >> >> On Tue, Feb 16, 2010 at 6:22 PM, Simone Chiaretta < >> [EMAIL PROTECTED]> wrote: >> >> > This is the email from the guy that reported the error: >> > >> > It seems like adding the permission to App_Data (where the indexes are >> > located) didn't help. >> > >> > Any ideas? >> > Simone >> > >> > ----------------------------- >> > >> > After adding Read/Write/Modify permissions to App_Data for "NETWORK >> > SERVICE" (what the app pool is running under), I got the same >> > permissions issue... but then also got a new one. >> > >> > I added the permissions and did a full IISRESET. I then hit the >> > successfully upgraded site (going to the admin page). The login screen >> > for the admin site came up and I entered my credentials. That's when I >> > got the exception we saw earlier: >> > >> > [SecurityException: Request for the permission of type >> > 'System.Security.Permissions.SecurityPermission, mscorlib, >> > Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' >> > failed.] >> > FileSupport.Sync(FileStream fileStream) +0 >> > Lucene.Net.Store.FSDirectory.Sync(String name) +151 >> > Lucene.Net.Index.SegmentInfos.FinishCommit(Directory dir) +171 >> > Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean >> > create, Boolean closeDir, IndexDeletionPolicy deletionPolicy, Boolean >> > autoCommit, Int32 maxFieldLength, IndexingChain indexingChain, >> > IndexCommit commit) +257 Simone Chiaretta Microsoft MVP ASP.NET - ASPInsider Blog: http://codeclimber.net.nz RSS: http://feeds2.feedburner.com/codeclimber twitter: @simonech Any sufficiently advanced technology is indistinguishable from magic "Life is short, play hard"
-
RE: Lucene.net in Medium TrustDigy 2010-05-06, 16:09
I updated the title of LUCENENET-357
Attaching your patch to that issue would be good. DIGY -----Original Message----- From: Simone Chiaretta [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 06, 2010 6:54 PM To: [EMAIL PROTECTED] Subject: Re: Lucene.net in Medium Trust Should I send a patch? Should I file a bug? Simone On Wed, May 5, 2010 at 12:06 PM, Simone Chiaretta < [EMAIL PROTECTED]> wrote: > Hi All, > sorry for taking so long to work on the issue: > Debugging so far, and found out that the problem was not in the open > method, but in the static constructor itself > > 1 - FSDirectory static constructor: > public static readonly System.String LOCK_DIR > SupportClass.AppSettings.Get("Lucene.Net.lockDir", > System.IO.Path.GetTempPath()); > GetTempPath raises a permission exception when running in medium trust... > since this is even an Obsolete method I just removed the line > > 2 - Utils.Constants static constructor: > System.Environment.GetEnvironmentVariable: raises an exception medium trust > as well: > The lines with problems are: > > - public static readonly System.String OS_NAME > System.Environment.GetEnvironmentVariable("OS") ?? "Linux"; > Just hardcoded "Windows" as I'm not running on other machines... I also > searched for usages and it's used only in two lines: one in the Directory > Open method in an if/else statement that does the same things in both trees, > and the other is in the IndexWriter where the DEFAULT_MAX_SYNC_PAUSE_SECONDS > is set based on whether it's Windows > - public static readonly System.String OS_ARCH > System.Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE"); > Used only as debugging info, so hardcoded it to x86 > - public static readonly System.String OS_VERSION > System.Environment.OSVersion.ToString() > Used only in debugging, hardcoded to String.Empty > > > With these changes it works even when setting the trust level to medium: > tested adding > <trust level="Medium" originUrl=".*" /> > in the config file of the applications > > hope this helps > Simo > > PS: I also found this blog post that talks about the same problems: > > http://www.klopfenstein.net/lorenz.aspx/lucene.net-on-medium-trust-nhibernat e-search-part-2 > <http://www.klopfenstein.net/lorenz.aspx/lucene.net-on-medium-trust-nhiberna te-search-part-2>Too > bad he didn't publish any code, but only released the compiled build file. > > On Tue, Feb 16, 2010 at 6:39 PM, digy digy <[EMAIL PROTECTED]> wrote: > >> The reason may be the "FlushFileBuffers" in >> "SupportClass.FileSupport.Sync". >> Can you change the code as below and try again? >> >> public static void Sync(System.IO.FileStream fileStream) >> { >> if (fileStream == null) throw new ArgumentNullException("fileStream"); >> fileStream.Flush(); >> } >> >> DIGY >> >> On Tue, Feb 16, 2010 at 6:22 PM, Simone Chiaretta < >> [EMAIL PROTECTED]> wrote: >> >> > This is the email from the guy that reported the error: >> > >> > It seems like adding the permission to App_Data (where the indexes are >> > located) didn't help. >> > >> > Any ideas? >> > Simone >> > >> > ----------------------------- >> > >> > After adding Read/Write/Modify permissions to App_Data for "NETWORK >> > SERVICE" (what the app pool is running under), I got the same >> > permissions issue... but then also got a new one. >> > >> > I added the permissions and did a full IISRESET. I then hit the >> > successfully upgraded site (going to the admin page). The login screen >> > for the admin site came up and I entered my credentials. That's when I >> > got the exception we saw earlier: >> > >> > [SecurityException: Request for the permission of type >> > 'System.Security.Permissions.SecurityPermission, mscorlib, >> > Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' >> > failed.] >> > FileSupport.Sync(FileStream fileStream) +0 >> > Lucene.Net.Store.FSDirectory.Sync(String name) +151 >> > Lucene.Net.Index.SegmentInfos.FinishCommit(Directory dir) +171 Subtext.Framework.Services.SearchEngine.SearchEngineService.EnsureIndexWrite r() Subtext.Framework.Services.SearchEngine.SearchEngineService.EnsureIndexWrite r() Subtext.Framework.Services.SearchEngine.SearchEngineService.DoWriterAction(F unc`2 Subtext.Framework.Services.SearchEngine.SearchEngineService.get_Searcher() Subtext.Framework.Services.SearchEngine.SearchEngineService.GetIndexedEntryC ount(Int32 SecurityPermission Boolean Boolean Subtext.Framework.Services.SearchEngine.SearchEngineService.EnsureIndexWrite Simone Chiaretta Microsoft MVP ASP.NET - ASPInsider Blog: http://codeclimber.net.nz RSS: http://feeds2.feedburner.com/codeclimber twitter: @simonech Any sufficiently advanced technology is indistinguishable from magic "Life is short, play hard"
-
Re: Lucene.net in Medium TrustSimone Chiaretta 2010-05-07, 08:08
Commented on that bug...
and added patch Simo On Thu, May 6, 2010 at 6:09 PM, Digy <[EMAIL PROTECTED]> wrote: > I updated the title of LUCENENET-357 > Attaching your patch to that issue would be good. > > DIGY > > > -----Original Message----- > From: Simone Chiaretta [mailto:[EMAIL PROTECTED]] > Sent: Thursday, May 06, 2010 6:54 PM > To: [EMAIL PROTECTED] > Subject: Re: Lucene.net in Medium Trust > > Should I send a patch? Should I file a bug? > Simone > > On Wed, May 5, 2010 at 12:06 PM, Simone Chiaretta < > [EMAIL PROTECTED]> wrote: > > > Hi All, > > sorry for taking so long to work on the issue: > > Debugging so far, and found out that the problem was not in the open > > method, but in the static constructor itself > > > > 1 - FSDirectory static constructor: > > public static readonly System.String LOCK_DIR > > SupportClass.AppSettings.Get("Lucene.Net.lockDir", > > System.IO.Path.GetTempPath()); > > GetTempPath raises a permission exception when running in medium trust... > > since this is even an Obsolete method I just removed the line > > > > 2 - Utils.Constants static constructor: > > System.Environment.GetEnvironmentVariable: raises an exception medium > trust > > as well: > > The lines with problems are: > > > > - public static readonly System.String OS_NAME > > System.Environment.GetEnvironmentVariable("OS") ?? "Linux"; > > Just hardcoded "Windows" as I'm not running on other machines... I > also > > searched for usages and it's used only in two lines: one in the > Directory > > Open method in an if/else statement that does the same things in both > trees, > > and the other is in the IndexWriter where the > DEFAULT_MAX_SYNC_PAUSE_SECONDS > > is set based on whether it's Windows > > - public static readonly System.String OS_ARCH > > System.Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE"); > > Used only as debugging info, so hardcoded it to x86 > > - public static readonly System.String OS_VERSION > > System.Environment.OSVersion.ToString() > > Used only in debugging, hardcoded to String.Empty > > > > > > With these changes it works even when setting the trust level to medium: > > tested adding > > <trust level="Medium" originUrl=".*" /> > > in the config file of the applications > > > > hope this helps > > Simo > > > > PS: I also found this blog post that talks about the same problems: > > > > > > http://www.klopfenstein.net/lorenz.aspx/lucene.net-on-medium-trust-nhibernat > e-search-part-2 > > > < > http://www.klopfenstein.net/lorenz.aspx/lucene.net-on-medium-trust-nhiberna > te-search-part-2>Too > > bad he didn't publish any code, but only released the compiled build > file. > > > > On Tue, Feb 16, 2010 at 6:39 PM, digy digy <[EMAIL PROTECTED]> wrote: > > > >> The reason may be the "FlushFileBuffers" in > >> "SupportClass.FileSupport.Sync". > >> Can you change the code as below and try again? > >> > >> public static void Sync(System.IO.FileStream fileStream) > >> { > >> if (fileStream == null) throw new ArgumentNullException("fileStream"); > >> fileStream.Flush(); > >> } > >> > >> DIGY > >> > >> On Tue, Feb 16, 2010 at 6:22 PM, Simone Chiaretta < > >> [EMAIL PROTECTED]> wrote: > >> > >> > This is the email from the guy that reported the error: > >> > > >> > It seems like adding the permission to App_Data (where the indexes are > >> > located) didn't help. > >> > > >> > Any ideas? > >> > Simone > >> > > >> > ----------------------------- > >> > > >> > After adding Read/Write/Modify permissions to App_Data for "NETWORK > >> > SERVICE" (what the app pool is running under), I got the same > >> > permissions issue... but then also got a new one. > >> > > >> > I added the permissions and did a full IISRESET. I then hit the > >> > successfully upgraded site (going to the admin page). The login screen > >> > for the admin site came up and I entered my credentials. That's when I > >> > got the exception we saw earlier: > >> Simone Chiaretta Microsoft MVP ASP.NET - ASPInsider Blog: http://codeclimber.net.nz RSS: http://feeds2.feedburner.com/codeclimber twitter: @simonech Any sufficiently advanced technology is indistinguishable from magic "Life is short, play hard" |