问题描述
我试图让Lucene.NET到一个共享的主机环境中工作。 Mascix在CodeProject上勾勒这里的他是怎么这对GoDaddy的工作。我在isqsolutions尝试此。
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" %>
我试着像这样web.config中添加一个直接引用Lucene.NET assambly:
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?
推荐答案
如果服务器上未安装Lucene.NET,你将不得不在Lucene.NET DLL复制在您的项目并添加引用到这个副本。现在,您可能有链接到在Program Files目录,例如某些DLL的引用。它存在于您的服务器上,而不是部署服务器。
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.
另外,您还可以设置属性复制到输出目录到始终复制的DLL。
Alternatively, you can also set the property 'Copy to output directory' to 'Copy always' on the dll.
这篇关于Lucene.NET上共享主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!