关于搜索如何配置 悬赏:0

!全文检索API add key=Search value=本站地址 /这里设置成自己网站的网址,不能搜索.提示:引发的异常:“System.UriFormatException”(位于 System.dll 中)/// summary /// 搜索全部 /// /summary /// param name=keyword关键字/param /// returns/returns [HttpGet] [UserAuthorize(isAnonymous = true)] public PartialViewResult _SearchAllResult(string keyword = ) { var url = ConfigurationManager.AppSettings[Search]; if (string.IsNullOrWhiteSpace(url) || string.IsNullOrWhiteSpace(keyword)) { return PartialView(new AllResultModel()); } keyword = Utilities.WebUtility.HtmlDecode(keyword); try { HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(string.Format({0}/Search/SearchAll?keyword={1}, url, keyword)); myRequest.Method = GET; HttpWebResponse myResponse = null; myResponse = (HttpWebResponse)myRequest.GetResponse(); if (myResponse.StatusCode == HttpStatusCode.OK) { StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.UTF8); string content = reader.ReadToEnd(); var results = JsonConvert.DeserializeObjectAllResultModel(content); ViewData[keyword] = keyword; return PartialView(results); } } catch (Exception) { return PartialView(new AllResultModel()); } return PartialView(new AllResultModel()); }

  • 近乎-技术支持
  • 近乎-技术支持
  • 最佳答案

您好, 这个错误表明您所填写的URL并不是一个有效的URL, 

请确认您在web.config文件中配置是正确的:

正确配置如下:

<!全文检索API>

<add key="Search" value="本站地址/这里设置成自己网站的网址(完整的URL地址)" />


其他0个回答
暂无任何回答