좋아요, 이것은 나를 미치게합니다.MVC 리소스를 찾을 수 없습니다.
나는이 프로젝트를 가지고 있으며, FeedController
을 건드리지 않고 월간입니다. 모든 것이 잘 작동했습니다. 그런 다음, FeedController
을 열어 액션 내부의 일부 코드를 변경했으며 어떤 이유로 VS2010이 손상되었습니다. 좋아, VS가 이미 추락 했어. 특이한 건 없었어.
FeedController
는
"404 리소스를 찾을 수 없습니다" 오류를 제공하기 시작했다.
그래서 Global.asax
, Web.Config
, StartURL을 확인했습니다. 모든 사람들이 추천합니다. 그것을 작동시킬 수 없습니다. /Feed/Index
으로 전화하면 작동합니다! 그러나 /Feed/
은 나에게 오류를 준다.
전체 컨트롤러의 이름이 ShitController
으로 변경되었습니다. 이제는 완벽하게 작동합니다! 어떻게 든 프로젝트는 "피드"가 일종의 "저주 단어"라고 결정했습니다.
정리 된 솔루션 /bin/
대 다시 시작된 컴퓨터와 다시 시작한 컴퓨터는 영원히 중개인입니다.
MVC3 심각한 버그라고 생각하기 시작했습니다.
누구?
나는 정신 나간다.
routes.MapRoute(
"XBLContentDetailsLocale",
"XBLContent/Details/{guid}/{locale}",
new { controller = "XBLContent", action = "Details"},
new { guid = @"[0-9|a-z|\-]{36}", locale = @"[a-z|A-Z]{2}-[A-Z|a-z]{2}"}
);
routes.MapRoute(
"XBLContentDetails",
"XBLContent/Details/{guid}",
new { controller = "XBLContent", action = "Details" },
new { guid = @"[0-9|a-z|\-]{36}" }
);
routes.MapRoute(
"XBLContentDaysLocale",
"XBLContent/{days}/{locale}",
new { controller = "XBLContent", action = "Index" },
new { days = @"[0-9]", locale = @"[a-z|A-Z]{2}-[A-Z|a-z]{2}" }
);
routes.MapRoute(
"XBLContentDays",
"XBLContent/{days}",
new { controller = "XBLContent", action = "Index" },
new { days = @"[0-9]" }
);
routes.MapRoute(
"FeedRouteFull",
"Feed/{action}/{sort}/{locale}",
new { controller = "Feed", action = "GameAddons" },
new { sort = @"[a-z|A-Z]+", locale = @"[a-z|A-Z]{2}-[A-Z|a-z]{2}" }
);
routes.MapRoute(
"FeedRouteSort",
"Feed/{action}/{sort}",
new { controller = "Feed", action = "GameAddons", sort = UrlParameter.Optional },
new { sort = @"[a-z|A-Z]+" }
);
routes.MapRoute(
"FeedRoute",
"Feed/{action}",
new { controller = "Feed", action = "Index" }
);
routes.MapRoute(
"Locale",
"{locale}",
new { controller = "Home", action = "Index" },
new { locale = @"[a-z|A-Z]{2}-[A-Z|a-z]{2}" }
);
routes.MapRoute(
"ControllerLocale",
"{controller}/{locale}",
new { controller = "Home", action = "Index", locale = UrlParameter.Optional },
new { locale = @"[a-z|A-Z]{2}-[A-Z|a-z]{2}" }
);
routes.MapRoute(
"ControllerActionLocale",
"{controller}/{action}/{locale}",
new { controller = "Home", action = "Index", locale = UrlParameter.Optional },
new { locale = @"[a-z|A-Z]{2}-[A-Z|a-z]{2}" }
);
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
UPDATE : 난 단지 기본을두고 모든 경로를 주석하고 오류가 여전히 존재 나는
경로 어쩌면 :), 산책을 가야한다.
업데이트 : 다음은 전체 컨트롤러입니다. 만 아케이드 액션을 변경하고 "oldcode"주석 : 이 구성에 대한 색인 작업을 변경하고 작동
public class FeedController : Controller
{
XBLContentContext db = new XBLContentContext();
private int activemenu = 4;
private const int QT_FEED = 12;
public ActionResult Index(string locale)
{
if (String.IsNullOrEmpty(locale))
locale = "en-us";
ViewBag.Title = "Xbox LIVE Feeds";
ViewBag.Description = "Xbox LIVE Feed generator. Configure and add it to your favourite feed reader.";
ViewBag.Keywords = "xbox, live, tools, feed, syndication, rss, atom";
ViewBag.ContentType = Enum.GetValues(typeof(ContentType)).Cast<ContentType>().Select(v => new SelectListItem
{
Selected = (v == ContentType.Arcade),
Text = v.ToString().ToSentence(),
Value = v.ToString()
});
ViewBag.SortBy = Enum.GetValues(typeof(SortBy)).Cast<SortBy>().Select(v => new SelectListItem
{
Selected = (v == SortBy.OfferStartDate),
Text = v.ToString().ToSentence(),
Value = v.ToString()
});
ViewBag.Regions = (from x in GlobalVariables.Regions
select new SelectListItem
{
Selected = (x.ID.ToLower() == locale),
Text = x.Country,
Value = x.ID.ToLower()
}).OrderBy(x => x.Text).ToList();
return View();
}
public ActionResult AllDownloads(string sort, string locale)
{
var today = DateTime.Today;
var region = "All Regions";
var qry = from c in db.XBLRegionalContents.Include("Region").Include("Content")
where c.PublishDate <= today
select c;
var qry2 = from c in qry
group c by c.ContentId into grouped
let maxdate = grouped.Max(x => x.PublishDate)
select new
{
Key = grouped.Where(x => x.ContentId == grouped.Key && (x.PublishDate == maxdate)).FirstOrDefault(),
Value = grouped.Where(x => x.ContentId == grouped.Key).Select(x => x.Region)
};
if (!String.IsNullOrEmpty(locale))
qry2 = from c in qry2
where c.Value.Any(x => x.ID == locale)
select c;
var model = qry2.OrderByDescending(x => x.Key.PublishDate).Take(QT_FEED).ToDictionary(x => x.Key, x => x.Value);
if (!String.IsNullOrEmpty(locale) && model.Count() > 0)
region = model.FirstOrDefault().Key.Region.CountryEnglish;
ViewBag.Language = locale;
ViewBag.FeedTitle = "XBLTOOLS - Latest Content";
ViewBag.FeedDescription = String.Format("{0} - {1}", region, DateTime.Now);
return View("GlobalFeed", model);
}
public ActionResult FullGames(string sort, string locale)
{
var today = DateTime.Today;
var region = "All Regions";
var indie = ContentType.IndieGames.ToString();
var qry = from c in db.XBLRegionalContents.Include("Region").Include("Content")
where c.Content.RelatedGameId == null && c.Content.FileSize > 0
&& c.PublishDate <= DateTime.Today
&& c.Content.ContentType != indie
select c;
var qry2 = from c in qry
group c by c.ContentId into grouped
select new
{
Key = grouped.Where(x => x.ContentId == grouped.Key).FirstOrDefault(),
Value = grouped.Where(x => x.ContentId == grouped.Key).Select(x => x.Region)
};
if (!String.IsNullOrEmpty(locale))
qry2 = from c in qry2
where c.Value.Any(x => x.ID == locale)
select c;
var model = qry2.OrderByDescending(x => x.Key.PublishDate).Take(QT_FEED).ToDictionary(x => x.Key, x => x.Value);
if (!String.IsNullOrEmpty(locale) && model.Count > 0)
region = model.FirstOrDefault().Key.Region.CountryEnglish;
ViewBag.Language = locale;
ViewBag.FeedTitle = "XBLTOOLS - Full Games";
ViewBag.FeedDescription = String.Format("{0} - {1}", region, DateTime.Now);
return View("GlobalFeed", model);
}
public ActionResult Arcade(string sort, string locale)
{
var page = db.XBLPages.First(x => x.Type == (int)XBLPageType.List);
using (XBLPageCrawler crawler = new XBLPageCrawler(page, ContentType.Arcade, DownloadType.Game, sort, locale))
{
var countrycode = String.IsNullOrEmpty(locale) ? String.Empty : String.Format("{0} - ", locale.Split('-')[1].ToUpper());
ViewBag.Language = locale;
ViewBag.FeedTitle = String.Format("{0}{1}", countrycode, crawler.CType.GetDescription());
return View("Feed", crawler.PageContent);
}
#region OLDCODE
// using (XBLChart p = new XBLChart(ContentType.Arcade, DownloadType.Game, sort, locale))
// {
// var countrycode = String.IsNullOrEmpty(locale) ? String.Empty : String.Format("{0} - ", locale.Split('-')[1].ToUpper());
// ViewBag.Language = locale;
// ViewBag.FeedTitle = String.Format("{0}{1}", countrycode, p.CType.GetDescription());
// return View("Feed", p.ListaRegional);
// }
#endregion
}
public ActionResult GamesOnDemand(string sort, string locale)
{
using (XBLChart p = new XBLChart(ContentType.GamesOnDemand, DownloadType.Game, sort, locale))
{
var countrycode = String.IsNullOrEmpty(locale) ? String.Empty : String.Format("{0} - ", locale.Split('-')[1].ToUpper());
ViewBag.Language = locale;
ViewBag.FeedTitle = String.Format("{0}{1}", countrycode, p.CType.GetDescription());
return View("Feed", p.ListaRegional);
}
}
public ActionResult IndieGames(string sort, string locale)
{
using (XBLChart p = new XBLChart(ContentType.IndieGames, DownloadType.Game, sort, locale))
{
var countrycode = String.IsNullOrEmpty(locale) ? String.Empty : String.Format("{0} - ", locale.Split('-')[1].ToUpper());
ViewBag.Language = locale;
ViewBag.FeedTitle = String.Format("{0}{1}", countrycode, p.CType.GetDescription());
return View("Feed", p.ListaRegional);
}
}
public ActionResult GameDemos(string sort, string locale)
{
using (XBLChart p = new XBLChart(ContentType.GameDemos, DownloadType.GameDemo, sort, locale))
{
var countrycode = String.IsNullOrEmpty(locale) ? String.Empty : String.Format("{0} - ", locale.Split('-')[1].ToUpper());
ViewBag.Language = locale;
ViewBag.FeedTitle = String.Format("{0}{1}", countrycode, p.CType.GetDescription());
return View("Feed", p.ListaRegional);
}
}
public ActionResult GameAddons(string sort, string locale)
{
using (XBLChart p = new XBLChart(ContentType.GameAddons, DownloadType.GameAddon, sort, locale))
{
var countrycode = String.IsNullOrEmpty(locale) ? String.Empty : String.Format("{0} - ", locale.Split('-')[1].ToUpper());
ViewBag.Language = locale;
ViewBag.FeedTitle = String.Format("{0}{1}", countrycode, p.CType.GetDescription());
return View("Feed", p.ListaRegional);
}
}
public ActionResult GameVideos(string sort, string locale)
{
using (XBLChart p = new XBLChart(ContentType.GameVideos, DownloadType.GameVideo, sort, locale))
{
var countrycode = String.IsNullOrEmpty(locale) ? String.Empty : String.Format("{0} - ", locale.Split('-')[1].ToUpper());
ViewBag.Language = locale;
ViewBag.FeedTitle = String.Format("{0}{1}", countrycode, p.CType.GetDescription());
return View("Feed", p.ListaRegional);
}
}
public ActionResult ThemesAndGamerPic(string sort, string locale)
{
using (XBLChart p = new XBLChart(ContentType.ThemesAndGamerPic, DownloadType.ThemesAndGamerPic, sort, locale))
{
var countrycode = String.IsNullOrEmpty(locale) ? String.Empty : String.Format("{0} - ", locale.Split('-')[1].ToUpper());
ViewBag.Language = locale;
ViewBag.FeedTitle = String.Format("{0}{1}", countrycode, p.CType.GetDescription());
return View("Feed", p.ListaRegional);
}
}
protected override void Dispose(bool disposing)
{
db.Dispose();
base.Dispose(disposing);
}
}
UPDATE를. 명시 적/피드/색인이 너무 효과적이기 때문에 문제는 기본 암시 적 "인덱스"와 같습니다.
경로를 게시 할 수 있습니까? 호스트 IDE가 충돌하여 문제가 발생하면 실제로 버그가 아닙니다. –
피드 컨트롤러 내에 여러 가지 방법이 있습니까? 컨트롤러 내에 코드와 코드를 호출하는 코드를 게시 할 수 있습니까? –
IIS에 배포합니까 아니면 로컬 개발 서버에서 실행합니까? – flup