Lucene.NET on shared hosting

风格不统一 提交于 2019-12-10 11:56:37

问题


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?


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/1708032/lucene-net-on-shared-hosting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!