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: nativefsl...@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]]
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"




--
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"

Reply via email to