<i id='sbCJM'><tr id='sbCJM'><dt id='sbCJM'><q id='sbCJM'><span id='sbCJM'><b id='sbCJM'><form id='sbCJM'><ins id='sbCJM'></ins><ul id='sbCJM'></ul><sub id='sbCJM'></sub></form><legend id='sbCJM'></legend><bdo id='sbCJM'><pre id='sbCJM'><center id='sbCJM'></center></pre></bdo></b><th id='sbCJM'></th></span></q></dt></tr></i><div id='sbCJM'><tfoot id='sbCJM'></tfoot><dl id='sbCJM'><fieldset id='sbCJM'></fieldset></dl></div>
    • <bdo id='sbCJM'></bdo><ul id='sbCJM'></ul>

  • <small id='sbCJM'></small><noframes id='sbCJM'>

    1. <tfoot id='sbCJM'></tfoot>

    2. <legend id='sbCJM'><style id='sbCJM'><dir id='sbCJM'><q id='sbCJM'></q></dir></style></legend>

        Lucene.Net 在我的主机上失败,因为它调用 GetTempPath().有什么工作?

        Lucene.Net fails at my host because it calls GetTempPath(). What#39;s the work around?(Lucene.Net 在我的主机上失败,因为它调用 GetTempPath().有什么工作?)

          <legend id='98zxT'><style id='98zxT'><dir id='98zxT'><q id='98zxT'></q></dir></style></legend>
            <bdo id='98zxT'></bdo><ul id='98zxT'></ul>
          • <i id='98zxT'><tr id='98zxT'><dt id='98zxT'><q id='98zxT'><span id='98zxT'><b id='98zxT'><form id='98zxT'><ins id='98zxT'></ins><ul id='98zxT'></ul><sub id='98zxT'></sub></form><legend id='98zxT'></legend><bdo id='98zxT'><pre id='98zxT'><center id='98zxT'></center></pre></bdo></b><th id='98zxT'></th></span></q></dt></tr></i><div id='98zxT'><tfoot id='98zxT'></tfoot><dl id='98zxT'><fieldset id='98zxT'></fieldset></dl></div>

                <tbody id='98zxT'></tbody>
                <tfoot id='98zxT'></tfoot>

                  <small id='98zxT'></small><noframes id='98zxT'>

                  本文介绍了Lucene.Net 在我的主机上失败,因为它调用 GetTempPath().有什么工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在共享主机上的 ASP.NET 应用程序中使用 Lucene.Net.得到了如下所示的堆栈跟踪.有什么工作?

                  I'm using Lucene.Net in an ASP.NET application on a shared host. Got this stack trace shown below. What's the work around?

                  [SecurityException: 请求System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"类型的权限失败.]System.Security.CodeAccessSecurityEngine.Check(对象需求, StackCrawlMark& stackMark, Boolean isPermSet) +0System.Security.CodeAccessPermission.Demand() +59System.IO.Path.GetTempPath() +54Lucene.Net.Store.FSDirectory..cctor() +73

                  [SecurityException: Request for the permission of type 'System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.] System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0 System.Security.CodeAccessPermission.Demand() +59 System.IO.Path.GetTempPath() +54 Lucene.Net.Store.FSDirectory..cctor() +73

                  推荐答案

                  这是我自己问题的答案.解决方案是修改 Lucene.Net.Store.FSDirectory,通过注释掉这个未使用的行:

                  Here's the answer to my own question. The solution was to modify Lucene.Net.Store.FSDirectory, by commenting out this unused line:

                  // Comments out by Corey Trager, Oct 2008 to workaround permission restrictions at shared host.  This is not used.
                  //        public static readonly System.String LOCK_DIR = SupportClass.AppSettings.Get("Lucene.Net.lockDir", System.IO.Path.GetTempPath());
                  

                  在那之后还有一个安全权限障碍,这也是解决方法.我不明白为什么一种获取目录中文件名的方式会被阻止,而另一种方式不会被阻止.

                  There was one more security permission hurdle after that, and here's that workaround too. I don't understand why one way of getting the names of files in a directory would be blocked, and another way not blocked.

                      public override System.String[] List()
                      {
                  
                  /* Changes by Corey Trager, Oct 2008, to workaround permission restrictions at shared host */
                              System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(directory.FullName);
                              System.IO.FileInfo[] files = dir.GetFiles();
                              string[] list = new string[files.Length];
                              for (int i = 0; i < files.Length; i++)
                              {
                                  list[i] = files[i].Name;
                              }
                              return list;
                  /* end of changes */
                  
                  //            System.String[] files = SupportClass.FileSupport.GetLuceneIndexFiles(directory.FullName, IndexFileNameFilter.GetFilter());
                  //            for (int i = 0; i < files.Length; i++)
                  //            {
                  //                System.IO.FileInfo fi = new System.IO.FileInfo(files[i]);
                  //                files[i] = fi.Name;
                  //            }
                  //            return files;
                          }
                  

                  这篇关于Lucene.Net 在我的主机上失败,因为它调用 GetTempPath().有什么工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Using entity Framework with .NET Core and DB2(将实体框架与 .NET Core 和 DB2 结合使用)
                  SQL1159 Initialization error with DB2 .NET Data Provider, reason code 10, tokens 0.0.0, 9.7.3(SQL1159 DB2 .NET 数据提供程序的初始化错误,原因代码 10,令牌 0.0.0、9.7.3)
                  Geolocation error with IP address 127.0.0.1(IP 地址为 127.0.0.1 的地理定位错误)
                  Geolocation web service recommendations(地理位置 Web 服务建议)
                  Finding clients location in an ASP.NET page(在 ASP.NET 页面中查找客户端位置)
                  Fetch Latitude Longitude by passing postcodes to maps.google.com using Javascript(通过使用 Javascript 将邮政编码传递给 maps.google.com 来获取纬度经度)

                    <tfoot id='bHHPQ'></tfoot>

                    <small id='bHHPQ'></small><noframes id='bHHPQ'>

                    • <bdo id='bHHPQ'></bdo><ul id='bHHPQ'></ul>

                            <tbody id='bHHPQ'></tbody>

                        • <i id='bHHPQ'><tr id='bHHPQ'><dt id='bHHPQ'><q id='bHHPQ'><span id='bHHPQ'><b id='bHHPQ'><form id='bHHPQ'><ins id='bHHPQ'></ins><ul id='bHHPQ'></ul><sub id='bHHPQ'></sub></form><legend id='bHHPQ'></legend><bdo id='bHHPQ'><pre id='bHHPQ'><center id='bHHPQ'></center></pre></bdo></b><th id='bHHPQ'></th></span></q></dt></tr></i><div id='bHHPQ'><tfoot id='bHHPQ'></tfoot><dl id='bHHPQ'><fieldset id='bHHPQ'></fieldset></dl></div>
                          1. <legend id='bHHPQ'><style id='bHHPQ'><dir id='bHHPQ'><q id='bHHPQ'></q></dir></style></legend>