現在我必須解決MVC.Asp.Net項目中的一些錯誤。在工程中的我有路線:MVC.ASP.NET和路由問題
的Global.asax
routes.MapRoute(
"Category no name",
"_C{id}.cfm",
new { controller = "Products", action = "Category" },
new { id = @"\d+" }
);
控制器:
public ActionResult Category(int id)
{
// Break point here
// doing smth
return View();
}
鑑於我有鏈接:當我使用Visual
<a href="@Url.Action("Category", "Products", new { id = category.CategoryId })">@category.Name</a>
一切工作正確Studio Development Server,但是當我嘗試在本地IIS服務器上運行項目時(我使用http://localhost/TestSite)這個鏈接有問題。它不起作用,我不能在我的控制器中陷入斷點。
爲什麼我有這種行爲?可能對我的鏈接錯誤嗎?我無法在global.asax中更改路由。
謝謝,您的任何想法
你使用IIS(5/6)。如果是這樣,請檢查這個網址http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx和http://blog.stevensanderson.com/ 2008/07/04/options-for-deployment-aspnet-mvc-to-iis-6/ –