views:

282

answers:

2

I'm trying to get Lucene.NET to work on a shared hosting environment. Mascix over on codeproject outlines here how he got this to work on godaddy. I'm attempting this on isqsolutions.

Both examples he posted run fine on my local machine and both throw the same error on the the shared hosting server:

Compiler Error Message: CS0246: The type or namespace name 'Lucene' could not be found (are you missing a using directive or an assembly reference?)

Line 1:  <%@ Page Language="C#" %>Line 2:  
Line 3:  <%@ Import Namespace="Lucene.Net.Index" %>
Line 4:  <%@ Import Namespace="Lucene.Net.Analysis.Standard" %>
Line 5:  <%@ Import Namespace="Lucene.Net.Documents" %>

I tried adding a direct reference to the Lucene.NET assambly in web.config like so:

<add assembly="Lucene.Net, Version=2.3.1.2, Culture=neutral, PublicKeyToken=a58a1be7fafc31f5"/>

But this throws its own error as well. I guess my question is: am I missing something simple or can a server side setting cause this to not work at all?

+2  A: 

If Lucene.NET is not installed on the server, you will have to copy the Lucene.NET dll in your project and add a reference to this copy. You now probably have a reference that links to some dll in a Program Files directory for example. Which exists on your server, but not the deployment server.

Alternatively, you can also set the property 'Copy to output directory' to 'Copy always' on the dll.

Razzie
Thanks for reply Razzie. This is how the website was setup in the first place. The Lucene.Net.dll exists in the bin folder. I haven't installed the lucene.net code, only downloaded a code sample which works fine on my local pc. My computer only has one copy of the dll as well, the one included in the code sample.
agrothe
well it's hard to tell what is wrong. I'm no expert on shared hosting but if what you say is all true, then that sounds ok to me. If you open the project file in a text editor, is the dll listed as a reference? Is its path correct? If so, then maybe you should contact the provider, maybe they can tell you something more. I'm not aware of any server side setting that could 'block' a dll. Your dll might require full trust, but at least that should give you a different error.
Razzie
+1  A: 

I created a asp.net app that uses Lucene and it works ok. Here´s a link to my post about it (Goomez). Also, the code is available for download. Hope it helps

sebastian