ASP.NET MVC部署到IIS 5/6与虚拟目录 [英] ASP.NET MVC deployment to IIS 5/6 with Virtual Directory

查看:130
本文介绍了ASP.NET MVC部署到IIS 5/6与虚拟目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个asp.net MVC应用程序,我要部署到IIS 5和/或6使用一个虚拟目录。

I have an asp.net MVC App that I want to deploy to IIS 5 and/or 6 using a Virtual Directory.

我已经执行了通配符的路由,但我有一个相对路径的问题。

I have already performed the wildcard routing, but I have a problem with relative paths.

想象我创建了一个称为对myApp的虚拟目录。

Imagine I have created a virtual directory called myApp.

部署我可以去后的http://本地主机/对myApp 并感到索引页面映入眼帘。我的索引页有定义为℃的链接; A HREF =/员工>员工与LT; / A> 点击该导航到
的http://本地主机/员工这将导致404错误。

After deploying I can go to http://localhost/myApp and am greeted by the index page. My index page has a link defined as <a href="/Employees">Employees</a>. Clicking on this navigates to http://localhost/Employees which results in a 404 error.

我想它导航到的http://本地主机/对myApp /员工代替,但我会preFER它,如果我没有到code中的虚拟目录名称到我的项目。

I would like it to navigate to http://localhost/myApp/Employees instead, but I would prefer it if I didn't have to code the virtual directory name into my project.

感谢您事先的任何帮助。

Thanks in advance for any help.

推荐答案

使用Html.ActionLink来生成超链接,而不是直接创建它们,我认为会为你排序。另外,使用./Employees应该把你带到任何你想去的地方。

Use Html.ActionLink to generate your hyperlinks rather than creating them directly, I think that'll sort it for you. Alternatively, use ./Employees which should get you where you want to go.

这篇关于ASP.NET MVC部署到IIS 5/6与虚拟目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆