I'm currently working on an MVC4 project, that is being deployed to an IIS6
hosting environment.
I am using Html.ActionLink()
to generate links on my page.
eg:
@Html.ActionLink("Home Link", "Index", "Admin")
When I run the application locally (ie hitting http://localhost:yyy
), the link is generated fine:
<a href="/Admin/Index">Home Link</a>
When I run it in the production environment however:
<a href="">Home Link</a>
As you can see, the link does not have a href
generated for it.
I thought it might be an issue with routing, but when I try to visit a page in the browser: admin/edit/45
, or one using a custom route binding: sf/24
, both of these work fine; they direct me to the page I expect.
I'm pretty out of ideas, and not sure on how to resolve.
Any help, would be greatly appreciated.
Thanks,
I've added a bounty to this, in the hope that it might help get an answer. I suspect this problem could help others, as I don't seem to be doing anything too groundbreaking.
UPDATE 24/09/14
This is being developed in VS2010 SP1, using the built-in web server (Cassini?).
I am then publishing (using the in-built options of Visual Studio) to the server, which is running IIS6.
The directory structure contains something similar to:
App_Start
Assets
Classes
Content
Controllers
DomainModel
Scripts
Services
SharedAssets
ViewModels
Views
(ie. nothing in there matches the names of any links).
On top of this, bundling seems to work. eg: @Scripts.Render("~/bundles/adminjs")
Using this (VB) Razor:
@Html.ActionLink("View", "Display", "Form", New With { .id = 72 }, Nothing)
<br />
@Html.RouteLink("View", "Default", new with { .controller = "Form", .action = "Display", .id = 72 })
I get the following output..
In VS10/Chrome (local):
<a href="/Form/Display/72">View</a>
<br>
<a href="/Form/Display/72">View</a>
In IIS6/Chrome (server):
<a href="">View</a>
<br>
<a href="">View</a>
..adding more to the mystery of it not picking up the routes..