2011-07-28 70 views
1

現在我必須解決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中更改路由。

謝謝,您的任何想法

+0

你使用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/ –

回答

0

我建議IIS配置不正確。嘗試爲IIS池設置集成模式。或者將.cfm擴展名映射到ASP .NET。

+0

謝謝,我設置了應用程序池= ASP.NET v4.0,這已經解決了我的問題 – ukraine

+0

太棒了!請將我的回答標記爲已接受,請:) –