iis托管mvc 5应用程序中的路径问题 [英] Path problem in iis hosted mvc 5 application

查看:71
本文介绍了iis托管mvc 5应用程序中的路径问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iis中托管了mvc 5应用程序,



I have hosted mvc 5 application in iis,

@{Html.RenderAction("Index", "Document", new { area = "DocumentsManagement", controlObjID = 9 });}





上面这个链接在本地工作正常,呈现为http:// localhost:1552:/ DocumentsManagement / Document / Index。





但是当从iis浏览时,它必须是http:// localhost / Publish / DocumentsManagement / Document / Index



其中Publish是应用程序文件夹或虚拟目录。

由于这个新级别发布,应用程序在iis中无法正常工作。



但这在本地工作正常



请建议。



This link above works fine in local and renders as http://localhost:1552:/DocumentsManagement/Document/Index.


But when browsed from iis, it will have to be http://localhost/Publish/DocumentsManagement/Document/Index

where Publish is the application folder or virtual directory.
Because of this new level "Publish", the application doesnt work fine in iis.

But this works fine in local

Please Suggest.

推荐答案

如果您的站点无法在虚拟目录中工作(您所描述的技术名称),那么您还没有正确编码。您可能正在构建自己的URL而不是让框架为您构建它们,例如,您有类似的代码;



If your site doesn't work in a virtual directory (the technical name for what you're describing) then you haven't coded it properly. You are probably constructing your own urls rather than getting the framework to construct them for you, eg you have code like;

<a href="/Account/Login">Login</a>





而不是





instead of

<a href="@Url.Action("Login", "Account")">Login</a>





如果您的代码正确,您的网站将有效。



If you code correctly your site will work.


这篇关于iis托管mvc 5应用程序中的路径问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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